赞
踩
- create table score(
- score int(3),
- st_id int(16),
- cs_id int(16),
- primary key(st_id,cs_id),
- FOREIGN KEY (st_id) REFERENCES student(id),
- FOREIGN KEY (cs_id) REFERENCES classes(id)
- );
alter table 表名 add constraint FK_ID foreign key(你的外键字段名) REFERENCES 外表表名(对应的表的主键字段名);
- create table score(
- cscore int(11),
- st_id int(50) references student(id),
- cs_id int(30) references classes(id),
- primary key(st_id,cs_id)
- );
- create table score(
- cscore int(11),
- st_id int(50),
- cs_id int(30),
- primary key(st_id,cs_id),
- CONSTRAINT `FK_ID_ST` FOREIGN KEY (st_id) REFERENCES student(id),
- CONSTRAINT `FK_ID_CS` FOREIGN KEY (cs_id) REFERENCES classes(id)
- );
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。