已知表xk(sno,cno,grade),创建规则,限定grade的范围在0-100之间,其正确语句为( )
A: create rule gradeRuleas @grade between 0 and 100
B: create gradeRuleas @grade between 0 and 100
C: create rule gradeRuleas grade between 0 and 100
D: create gradeRuleas grade between 0 and 100
A: create rule gradeRuleas @grade between 0 and 100
B: create gradeRuleas @grade between 0 and 100
C: create rule gradeRuleas grade between 0 and 100
D: create gradeRuleas grade between 0 and 100
举一反三
- 在SC表中添加约束,限定成绩Grade的取值范围为0-100,将下面的SQL语句补充完整。正确的选项是( )。 Alter Table SC Add CJ (Grade>=0 And Grade<=100)
- 查询编号为'c01'的课程考试成绩在80-89之间的学生的学号,下列()语句不能实现。 A: select sno ,grade from sc where cno='c01' and grade between 80 and 89 B: select sno ,grade from sc where cno='c01' and grade>=80 and grade<90 C: select sno ,grade from sc where cno='c01' and not (grade90) D: select sno ,grade from sc where cno='c01' and grade in (80-89)
- 在学生选课数据库中,将所有选了课程‘DB’且分数在60~70分之间的学生的成绩增加百分之十,SQL语句为( ) A: UPDATE SC SET Grade=Grade*1.1 WHERE Cno=’DB’ AND Grade BETWEEN 60 AND 70; B: UPDATE SC SET Grade+=Grade*0.1 WHERE Cno=(Select Cno From Course WHERE Cname=’DB’) AND Grade >= 60 AND Grade <=70; C: UPDATE SC SET Grade=Grade*1.1 WHERE Cno=(Select Cno From Course WHERE Cname=’DB’) AND Grade <= 60 AND Grade >=70; D: UPDATE SC SET Grade=Grade*1.1 WHERE Cno IN (Select Cno From Course WHERE Cname=’DB’) AND Grade BETWEEN 60 AND 70;
- 在“学生-课程”数据库中,当定义SC表时对字段Grade进行约束:Grade SMALLINT CHECK (Grade>=0 AND Grade<=100),如果SC表中原有记录('201215121','7',92),那么当执行"UPDATE SC SET Grade=Grade+10"时,数据库和DBMS将___________。 A: SC表数据不变,DBMS报错不允许更新 B: 记录('201215121','7',92)更新为('201215121','7',100),DBMS提醒Grade值不能超过100 C: 记录('201215121','7',92)更新为('201215121','7',NULL),DBMS提醒Grade值不能超过100 D: SC表数据不变,DBMS显示语句语法正确
- 设有关系模式:SC(sno,cno,grade),各属性含义依次是学号、课程号、分数。要查询分数低于60分的学生学号,正确的SQL语句是______。 A: SEI,ECT sno FROM SC WH ERE grade BETWEEN O AND 60 B: SELECT sno FROM SC WHERE grade<60 C: SELECT sno FROM SC HAVlNG grade BETWEEN O AND 60 D: SELECT sno FROM SC HAVING grade<60