use studb
-- 创建成绩表score,score的取值在0~100之间
-- 检查约束和非空约束只能是列级约束
create table score(
sno nchar(6) not null,
cno nchar(6),
score int constraint ck_score check(0<=score and score<=100)
)
-- 添加检查约束
alter table students
with nocheck -- 不检查表中数据
add
constraint ck_sex check(sex='男' or sex='女')
-- 删除check约束
alter table students
drop
constraint ck_sex
7.对check的操作
猜你喜欢
转载自blog.csdn.net/qq_53183608/article/details/121705278
今日推荐
周排行