2012-03-19 66 views
-2

我现在正在使用PHPMyAdmin,并且正在用下面的这些值创建一个新表,但它不工作,我看不出为什么。为什么MySQL语句不工作?

SQL查询:

CREATE TABLE `database`.`hub_attendance_lessons` (

`id` BIGINT(10) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , 
`lesson_id` BIGINT(10) UNSIGNED NOT NULL , 
`course_id` BIGINT(10) UNSIGNED NOT NULL , 
`student_id` BIGINT(10) UNSIGNED NOT NULL , 
`date` BIGINT(10) UNSIGNED NOT NULL , 
`attended` BOOL(2) UNSIGNED NULL , 
`absent` BOOL(2) UNSIGNED NULL , 
`excused_absent` BOOL(2) UNSIGNED NULL , 
`late` BOOL(2) UNSIGNED NULL , 
`excused_late` BOOL(2) UNSIGNED NULL 
) 
ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci 
COMMENT = 'stores the attendance of all lessons for all students'; 

MySQL表示:

#1064 - 你在你的SQL语法错误;检查对应于您 MySQL服务器版本正确的语法使用附近的手册 '(2)UNSIGNED NULL,absent BOOL(2)UNSIGNED NULL,`excused_absent` BOOL(2)UNSI' 在行1

回答

1

BOOLBOOLEAN只是TINYINT(1)的简写。有一个BOOL(2)是没有意义的。删除所有长度为2的布尔值。

+0

它自动做到这一点。我所有的布尔长度字段都是空的 – 2012-03-19 17:46:48

相关问题