Chinaunix首页 | 论坛 | 博客
  • 博客访问: 547047
  • 博文数量: 136
  • 博客积分: 4010
  • 博客等级: 上校
  • 技术积分: 1343
  • 用 户 组: 普通用户
  • 注册时间: 2008-08-19 23:18
文章分类

全部博文(136)

文章存档

2011年(28)

2009年(60)

2008年(48)

我的朋友

分类: 数据库开发技术

2009-04-05 12:18:56

今天帮舍友做毕业设计的时候用到了一个表,需要复合主键关联的成绩表,为了备忘,把语句给记下来
 

create table score
(
stu_id integer not null,
type_id integer not null,
score integer not null,
primary key(stu_id,type_id),
foreign key(stu_id) references student(stu_id),
foreign key(type_id) references examtype(type_id)
);

 

其中stu_id是student表的主键,type_id是examType表的主键

阅读(3118) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~