008.建立主从表(sql实例)
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)
)
关注90後梦想大师,梦想从未止步.