mysql数据库创建表出错误

时间:2022-06-01 18:33:31

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 'Group( GId int ,GCName varchar(20),GCSex varchar(10),GCIDCard int(20) not null p' at line 1

今晚上 执行这条语句时报错,

create table Group( GId int ,GCName varchar(20),GCSex varchar(10),GCIDCard int(20) not null primary key,          RoomId int,GCPhone int(20),foreign key (RoomId) references room(RoomId));



找了半天原因,原来是group是mysql的关键字,不能作为表名!!!谨记!