2016-05-16 4 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の上で同様の質問を見ていると、そのコードの問題は、それが余分なコンマがありました。私の問題は異なっているようです。

EDIT:以下 はそれを上回っているコードで、

-- 
-- 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

私の質問には、上記のコードを追加しました。 –

関連する問題