时间:2021-07-01 10:21:17 帮助过:18人阅读
CREATE TABLE info
(
snumb int primary key identity(1,1),
sname varchar(20),
sex bit,
birthday datetime check(birthday<getdate()),
[address] varchar(50),
tel varchar(30)
)
CREATE TABLE lesson
(
ccode varchar(5)primary key,
cname varchar(40),
cnum int
)
CREATE TABLE score
(
snumb int foreign key references info(snumb),
ccode varchar(5)foreign key references lesson(ccode),
score int check(score>0)
)
008.建立主从表(sql实例)
标签:less date date() 主从 reference for prim check entity