在“学生-课程”数据库中,当定义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显示语句语法正确
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显示语句语法正确
举一反三
- 把student表中id字段值小于3的记录,将这些记录的grade字段值都更新为100() A: UPDATE FROM student SET grade=100 where id<;3 B: UPDATE student SET grade=100 where id<;3 C: UPDATE student SET grade=100 D: UPDATE INTO student SET grade=100 where id<;3
- 在SC表中添加约束,限定成绩Grade的取值范围为0-100,将下面的SQL语句补充完整。正确的选项是( )。 Alter Table SC Add CJ (Grade>=0 And Grade<=100)
- “把查询sc表和更新sc表的grade列的权限受予用户user1”的正确SQL语句是()。 A: GRANT SELECT, UPDATE(gradON TABLE sc TO user1 B: GRANT SELECT sc, UPDATE sc, grade TO user1 C: GRANT SELECT, UPDATE ON TABLE s grade TO user1 D: GRANT SELECT ON TABLE sc, UPDATE ON TABLE sc(grad TO user1
- 已知关系模式:sc(sno,sname,grade),各属性含义依次为学号、课程名、分数。要查找“数据库”课分数最高的学生的学号,正确的SQL语句是 A: SELECT sno FROM sc WHERE sname = "数据库" AND grade = MAX(grade) B: SELECT sno FROM sc FOR sname = "数据库" OR grade>=MAX(grade) C: SELECT sno FROM sc WHERE sname = "数据库" AND grade = (SELECT MAX(grade) FROM sc) D: SELECT sno FROM sc FOR sname = "数据库" OR grade = (SELECT MAX(grade) FROM sc)
- “把查询SC表和更新SC表的grade列的权限授予用户user”的正确SQL语句是( )。 A: GRANT SELECT sc.UPDATE sc.grade TO user B: GRANT SELECT,UPDATE(grade)ON TABLE sc TO user C: GRANT SELECT,UPDATE ON TABLE sc.grade TO user D: GRANT SELECT ON TABLE sc,UPDATE ON TABLE sc(grade)TO user