我是my sql新手,从mysql数据库中编写sql脚本,我的大多数表都能工作,但有些表不能工作,mysql错误是尽可能不可描述的。这可能与多个外键有关。
create table Users (
id int not null auto_increment,
type enum('t1', 't2', 't3') not null,
name char(30) not null,
phone char(15),
email char(30),
username char(30),
password char(30),
created timestamp,
primary key (id)
);
create table Groups (
id int not null auto_increment,
user int not null,
name char(30) not null,
phone char(15),
email char(30),
created timestamp,
primary key (id),
foreign key (user) references Users(id)
);
create table Group_Members (
id int not null auto_increment,
group int not null,
user int not null,
created timestamp,
primary key (id),
foreign key (group) references Groups(id),
foreign key (user) references Users(id)
);