一、原题
二、题目翻译
三、题目解析
Which two statements are true regarding constraints? (Choose two.)
A. A foreign key cannot contain NULL values.
B. A column with the UNIQUE constraint can contain NULL values.
C. A constraint is enforced only for the INSERT operation on a table.
D. A constraint can be disabled even if the constraint column contains data.
E. All constraints can be defined at the column level as well as the table level.
答案:BD
A. A foreign key cannot contain NULL values.
B. A column with the UNIQUE constraint can contain NULL values.
C. A constraint is enforced only for the INSERT operation on a table.
D. A constraint can be disabled even if the constraint column contains data.
E. All constraints can be defined at the column level as well as the table level.
答案:BD
二、题目翻译
关于约束哪两个句子是正确的?(选择两个)
A. 外键不能包含空值。
B. 唯一约束的列可以包含空值。
C. 约束只能作用在INSERT操作上。
D. 即使约束列包含数据,约束也能被禁用。
E. 所有能在列级定义的约束,也能在表级定义。
A. 外键不能包含空值。
B. 唯一约束的列可以包含空值。
C. 约束只能作用在INSERT操作上。
D. 即使约束列包含数据,约束也能被禁用。
E. 所有能在列级定义的约束,也能在表级定义。
三、题目解析
A选项不正确,因为外键可以包含空值。
B选项正确,唯一约束可以包括空值,并用可以包括无数个空值。
C选项不正确,因为约束可以作用在INSERT,UPDATE,DELETE操作上。
D选项正确,因为disable,和列中有没有数据没关系,只是暂时禁用。
E选项不正确,因为NOT NULL约束只能在列级定义,不能在表级定义。(实际上,not null约束也可以用check约束实现表级约束)
B选项正确,唯一约束可以包括空值,并用可以包括无数个空值。
C选项不正确,因为约束可以作用在INSERT,UPDATE,DELETE操作上。
D选项正确,因为disable,和列中有没有数据没关系,只是暂时禁用。
E选项不正确,因为NOT NULL约束只能在列级定义,不能在表级定义。(实际上,not null约束也可以用check约束实现表级约束)