Augensterm

博客园 首页 新随笔 联系 订阅 管理

SQL语句如下:

CREATE TABLE IF NOT EXISTS `student`{
`id` INT(4) NOT NULL COMMENT '学号',
`name` VARCHAR(30) NOT NULL DEFAULT '匿名' COMMENT '姓名',
`pwd` VARCHAR(20) NOT NULL DEFAULT '23456' COMMENT '密码',
`sex` VARCHAR(2) NOT NULL DEFAULT '男' COMMENT'性别',
PRIMARY KEY(`id`)
}ENGINE=INNODB DEFAULT CHARSET=UTF8

报错:

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 '{
`id` INT(4) NOT NULL COMMENT '学号',
`name` VARCHAR(30) NOT NULL DE' at line 1

解决方案:

把CREATE TABLE IF NOT EXISTS `student`{

}之后的{}括号改成()

 

posted on 2020-09-18 10:58  Augensterm  阅读(229)  评论(0编辑  收藏  举报