关于mysql建表语句,好奇怪的问题!
代码如下:
--BBS数据库
create database BBS;
use BBS;
create table user (
UserID int(10) not null auto_increment primary key,
UseName varchar(20) not null,
password varchar(30) not null,
sex varchar(2) not null,
birthday datetime not null,
tel varchar(10),
logindate datetime not null,
grade varchar(20) not null,
email varchar(100) not null,
QQ int(10),
status varchar(4) not null,
address varchar(100) not null,
postcode varchar(6),
photo varchar(50) not null,
point int(10) not null,
homepage varchar(50),
postnumber int(10) not null,
lastvisit datetime not null
);
create table topic(
postID int(10) not null auto_increment primary key,
aunthor int(10) not null,
content text not null,
face varchar(50) not null,
visit int(10) not null,
back int(10) not null,
modifytime datetime not null,
settop varchar(2) not null,
goodtopic varchar(2) not null,
lockup varchar(2) not null
);
create table reply(
replyID int(10) not null auto_increment primary key,
topicID int(10) not null,
content text not null,
replyuser varchar(20) not null,
replytime datetime not null,
lastreplytime datetime not null
);
第二个第三个表顺利建好,但第一个表出现问题,错误如下:
ERROR 1064 (42000): 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 ',
status varchar(4) not null,
address varchar(100) not null,
postcode varcha ' at line 11
本以为语句错误,于是将第一个表拆成五个表来建,顺利建好,没改过任何一条语句,但是就是合起来就建不好!郁闷当中!
------解决方案--------------------没问题啊,我直接copy你的sql语句可以运行的啊
------解决方案--------------------QQ int(10),
注意这里的逗号是全角的。
必须是半角。
------解决方案--------------------楼上说的是,你的错误提示信息中不也说明了么?