create table SBook(
schoolYear TINYINT not null check(schoolYear in ('1','2','3','4','5','6','7','8')),/*取值范围*/
Number Smallint check(Number like '[0-9][0-9][0-9]' and Number!='000'),/*正则*/
courseNo char(3) not null, /*非空*/
bookNo char(6) not null check(bookNo like 'CN[0-9][0-9][0-9][0-9]'),/*正则*/
primary key(courseNo,bookNo), /*组合主键*/
foreign key(courseNo) references Course(courseNo) /*参照 references 不可少*/
)
数据库 组合主键 外键
最新推荐文章于 2024-06-28 09:20:01 发布
2709

被折叠的 条评论
为什么被折叠?



