我们在DBMS中记录数据库员工和员工工作信息,要求当某个员工离职后,数据库需要自动删除该员工的工作信息,在定义工作表时我们对于外关键字的删除规则应定义为
A: ON DELETE ROLLBACK
B: ON DELETE CASCADE
C: ON DELETE SET NULL
D: ON DELETE NO ACTION
A: ON DELETE ROLLBACK
B: ON DELETE CASCADE
C: ON DELETE SET NULL
D: ON DELETE NO ACTION
举一反三
- 已知有员工和员工亲属两个表,当员工调出离职时,应该先从员工亲属表中删除对应的亲属数据行,再删除员工表中该员工的数据行,因此当删除员工时应该检查员工亲属表中是否还有对应亲属数据行,如果有应该先不删除,提示先去删除员工亲属,在SQL语言中定义这个触发器时的正确短语是( ) A: .INSTEAD OF DELETE B: INSTEAD OF DROP C: .AFTER DELETE D: AFTER UPDATE
- 已知企业员工管理数据库中员工表结构如下:员工(工号,姓名,性别,年龄,部门)。现要从该表删除一条工号为“1001”的员工记录,则删除语句应该是() A: delete from 员工 where 工号=1001 B: delete * from员工where工号=1001 C: delete员工where工号 is 1001 D: delete * from员工where工号 is 1001
- 已知员工和员工亲属两个关系,当员工调出时,应该从员工关系中删除该员工的记录,同时在员工亲属关系中删除对应的亲属记录。在SQL语言中利用触发器定义这个完整性约束的短语是( )。 A: INSTEAD OF DELETE B: INSTEAD OF DROP C: AFTER DELETE D: AFTER UPDATE
- 如果在“学生-课程”数据库中,希望当删除Student表中的元组时,级联删除SC表中相应的元组,则在定义SC表时,应有语句____________________。 A: FOREIGN KEY (Sno) ON DELETE CASCADE Student(Sno) B: FOREIGN KEY (Sno) ON DELETE NO ACTION Student(Sno) C: FOREIGN KEY (Sno) REFERENCES Student(Sno) ON DELETE NO ACTION D: FOREIGN KEY (Sno) REFERENCES Student(Sno) ON DELETE CASCADE
- 已知职工和职工亲属两个关系,当职工调出时,应该从职工关系中删除该职工的元组,同时在职工亲属关系中删除对应的亲属元组, 在SQL语言中,定义这个完整性约束的短语是( ) A: ON DELETE ALL B: ON DELETE RESTRICT C: ON DELETE SET NULL D: ON DELETE CASCADE