MySQL报错#1064 - You have an error in your SQL syntax; ......
CREATETABLE`user`(`id`INT(10)NOTNULL,`user`VARCHAR(100)CHARACTERSETgb2312COLLATEgb231...
CREATE TABLE `user` (
`id` INT( 10 ) NOT NULL ,
`user` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`pwd` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`sex` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`age` INT( 3 ) NOT NULL ,
`email` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`phone` INT( 12 ) NOT NULL ,
`createtime` DATETIME NOT NULL ,
`isadmin` BOOL( 5 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET gb2312 COLLATE gb2312_chinese_ci
我懂SQL语句懂的不多,请高手帮忙指出错误 展开
`id` INT( 10 ) NOT NULL ,
`user` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`pwd` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`sex` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`age` INT( 3 ) NOT NULL ,
`email` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`phone` INT( 12 ) NOT NULL ,
`createtime` DATETIME NOT NULL ,
`isadmin` BOOL( 5 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET gb2312 COLLATE gb2312_chinese_ci
我懂SQL语句懂的不多,请高手帮忙指出错误 展开
展开全部
修改成这样
=============================
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` INT( 10 ) NOT NULL ,
`user` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`pwd` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`sex` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`age` INT( 3 ) NOT NULL ,
`email` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`phone` INT( 12 ) NOT NULL ,
`createtime` DATETIME NOT NULL ,
`isadmin` BOOL NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
==============
提示`isadmin` BOOL( 5 ) NOT NULL ,错误
原因BOOL 是TINYINT(1)的同义词。0值被视为假。非0值视为真
也就是说,bool只有两个值0或1,所以你的BOOL( 5 ) 不是可以这样写的
创建表的时候,你可以给个默认值给它的,如`isadmin` BOOL NOT NULL default 0,
=============================
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` INT( 10 ) NOT NULL ,
`user` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`pwd` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`sex` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`age` INT( 3 ) NOT NULL ,
`email` VARCHAR( 100 ) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL ,
`phone` INT( 12 ) NOT NULL ,
`createtime` DATETIME NOT NULL ,
`isadmin` BOOL NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM CHARACTER SET gb2312 COLLATE gb2312_chinese_ci;
==============
提示`isadmin` BOOL( 5 ) NOT NULL ,错误
原因BOOL 是TINYINT(1)的同义词。0值被视为假。非0值视为真
也就是说,bool只有两个值0或1,所以你的BOOL( 5 ) 不是可以这样写的
创建表的时候,你可以给个默认值给它的,如`isadmin` BOOL NOT NULL default 0,
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询