2016-05-16 46 views
0

我得到以下錯誤:#1064 - 您的SQL語法錯誤;逗號不能缺少

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `blog` (
`Blog_ID` int(11) NOT NULL, 
    `Blog_Name` va' at line 53 

下面是我的代碼,

CREATE TABLE IF NOT EXISTS `blog` (
    `Blog_ID` int(11) NOT NULL, 
    `Blog_Name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, 
    `User_User_ID` int(11) NOT NULL, 
    `Blog_Url` varchar(45) COLLATE utf8_unicode_ci NOT NULL, 
    `Blog_Sort` tinyint(4) DEFAULT NULL, 
    `Blog_Parent` tinyint(4) NOT NULL DEFAULT '0', 
    `Blog_Status` tinyint(4) NOT NULL DEFAULT '0', 
    `Blog_Date` timestamp NULL DEFAULT NULL, 
    `Blog_Publish` datetime DEFAULT NULL, 
    `Blog_Content` mediumblob 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 

我看到的StackOverflow的類似的問題,並與他們的代碼的問題是它有一個額外的逗號。我的問題似乎有所不同。

編輯: 下面是這僅僅是它上面的代碼,

-- 
-- Table structure for table `attendance_type` 
-- 

CREATE TABLE IF NOT EXISTS `attendance_type` (
`Attendance_ID` int(11) NOT NULL, 
    `Attendance_Code` text, 
    `Attendance_Desc` text, 
    `Attendance_Meaning` varchar(45) DEFAULT NULL, 
    `Attendance_Action` text NOT NULL, 
    `Attendance_Action_Group` varchar(45) NOT NULL 
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1; 

-- 
-- Dumping data for table `attendance_type` 
-- 

INSERT INTO `attendance_type` (`Attendance_ID`, `Attendance_Code`, `Attendance_Desc`, `Attendance_Meaning`, `Attendance_Action`, `Attendance_Action_Group`) VALUES 
(3, '#', 'School closed to pupils', 'Not counted in possible attendance', 'yes', '5'), 
(4, '/', 'Present (a.m.)', 'Present', 'no', '1'), 
(5, '\\', 'Present (p.m.)', 'Present', '', '1'), 
(6, 'B', 'Educated Off Site (NOT Dual Registration)', 'Appoved Education Activity (Present)', 'yes', '2'), 
(7, 'C', 'Other Authorised Circumstance (not covered by other appropriate code/description', 'Authorised Absence', 'yes', '4'), 
(8, 'D', 'Dual Registration (ie pupil attending other establishment)', 'Not counted in possible attendance', '', '5'), 
(9, 'E', 'Excluded (no alternative provision made)', 'Authorised Absence', 'yes', '4'), 
(10, 'G', 'Family Holiday (NOT agreed or days in excess of agreement)', 'Unauthorised Absence', 'yes', '3'), 
(11, 'H', 'Family Holiday (Agreed)', 'Authorised Absence', 'yes', '4'), 
(12, 'I', 'Illness (NOT medical or dental etc. appointments)', 'Authorised Absence', 'yes', '4'), 
(13, 'J', 'Interview', 'Appoved Education Activity (Present)', 'yes', '2'), 
(14, 'L', 'Late (before registers closed)', 'Present', 'no', '1'), 
(15, 'M', 'Medical/Dental appointments', 'Authorised Absence', 'yes', '4'), 
(16, 'N', 'No reason yet provided for absence', 'Unauthorised Absence', 'yes', '3'), 
(17, 'O', 'Unauthorised absence (not covered by any other code/description)', 'Unauthorised Absence', '', '3'), 
(18, 'P', 'Approved Sporting Activity', 'Appoved Education Activity (Present)', 'yes', '2'), 
(19, 'R', 'Religious Observance', 'Authorised Absence', 'yes', '4'), 
(20, 'S', 'Study Leave', 'Authorised Absence', 'yes', '4'), 
(21, 'T', 'Traveller Absence', 'Authorised Absence', 'yes', '4'), 
(22, 'U', 'Late (After registers closed)', 'Unauthorised Absence', '', '3'), 
(23, 'V', 'Educational Visit or Trip', 'Appoved Education Activity (Present)', 'yes', '2'), 
(24, 'W', 'Work Experience', 'Appoved Education Activity (Present)', 'yes', '2'), 
(25, 'X', 'Untimetabled sessions for non-compulsory school-aged pupils', 'Not counted in possible attendance', 'yes', '5'), 
(26, 'Y', 'Enforced and partial enforced closure', 'Not counted in possible attendance', 'yes', '5'), 
(27, 'Z', 'Pupil not yet on roll', 'Not counted in possible attendance', 'yes', '5'); 

-- -------------------------------------------------------- 
+2

你如何執行該操作?錯誤從您的陳述開始時開始。在此之前的任何陳述,你同時執行? –

+0

@juergend:它是一個.sql文件的片段。 –

+3

在那之前有什麼聲明呢?也許你在前面的陳述結尾處忘了';' –

回答

0

這是最有可能的語法來此查詢之前,這裏的代碼是罰款所致。 See here:

+0

我已經在我的問題中添加了它上面的代碼。 –