mysql建立外键表

//user
create table users(id int primary key  auto_increment not null,username varchar(50) not null,userpassword varchar(50) not null);

 

//buyer
create table buyers(buyer_id int auto_increment not null,buyers_name varchar(60) not null,buyed_goods varchar(60) not null,
    buyed_num varchar(80) not null,used_money varchar(80) not null,buyer_addr varchar(90) not null,
    foreign key(buyer_id) references users(id));

猜你喜欢

转载自www.cnblogs.com/zhaocundang/p/9267793.html