2016-05-16 190 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

我已经在我的问题中添加了它上面的代码。 –