首页 > 电脑

数据库建表

更新时间2019-06-13 04:59:24

mysql> create table order(

    -> oid varchar(20) primary key,

    ->     uid varchar(20),

    -> gid varchar(20),

    -> orderdate datetime,

    -> status varchar(20),

    -> foreign key(uid) references user(user.uid),

    -> foreign key(gid) references goods(goods.gid)

    -> );

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 'order(

oid varchar(20) primary key,

    uid varchar(20),

gid varchar(20),

orderd' at line 1

gid 和uid 为另外2表主键

一个最基本的错,order是mysql的关键字,不能做表名的,改为其它的如order1就可以了

相关标签:数据库

上一篇:重庆语言障碍培训

下一篇:语句selectname,sex,birthdayFROMhuman返回第几列