2 qq 24262861 qq_24262861 于 2016.04.15 16:44 提问

mysql create 的问题 这是什么错误

CREATE TABLE student (
sno INT (20) NO NULL ,
sname VARCHAR (60) NO NULL,

sex VARCHAR (2) NO NULL ,
dept VARCHAR (18) NO NULL ,
birth DATE() NO NULL,
age INT (10) NO NULL CHECK (age > '0' AND age < '100'),
CHECK (sex = OR sex = ),
CHECK (dept = '信息系' OR dept = '计算机科学系' OR dept = '数学系' OR dept = '管理系' OR dept = '中文系' OR dept = '外语系' OR dept = '法学系'),
UNIQUE (sno)
);

错误:::
Query : create table student ( sno int (20) no null , sname varchar (60) no null, sex varchar (2) no null , dept varcha...
Error Code : 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 'no null ,
sname varchar (60) no null,

sex varchar (2) no null ,
dept' at line 2
Execution Time : 00:00:00:000
Transfer Time : 00:00:00:000
Total Time : 00:00:00:000

这个错误怎么改???求大神指导,在线等~~~~

2个回答

xiaoyao880609
xiaoyao880609   2016.04.15 16:53

CREATE TABLE student(
sno INT (20) NOT NULL ,
sname VARCHAR (60) NOT NULL,

sex VARCHAR (2) NOT NULL ,
dept VARCHAR (18) NOT NULL ,
birth DATETIME NOT NULL,
age INT (10) NOT NULL CHECK (age > '0' AND age < '100'),
CHECK (sex = 男 OR sex = 女),
CHECK (dept = '信息系' OR dept = '计算机科学系' OR dept = '数学系' OR dept = '管理系' OR dept = '中文系' OR dept = '外语系' OR dept = '法学系'),
UNIQUE (sno)
);
试试我这个。

qq_24262861
qq_24262861 已经解决了,谢谢0.0
一年多之前 回复
CSDNXIAOD
CSDNXIAOD   2016.04.15 16:52

MySQL中的 create sequence 错误
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!