标签:主键 prim inno ODB innodb Nid 外键 ons 创建
--创建主键
create table t1(
nid int(11) not null auto_increment,
pid int(11),
num int(11),
primary key(nid,pid)
) engine=innodb default charset=utf8;
--创建外键
create table t2(
id int auto_increment primary key,
name char(10),
id1 int,
id2 int,
constraint fk_t2_t1 foreign key(id1,id2) references t1(nid,pid)
) engine=innodb default charset=utf8;
标签:主键 prim inno ODB innodb Nid 外键 ons 创建
原文地址:https://www.cnblogs.com/luckiness/p/13087277.html