170. Which two statements are true regarding the DELETE and TRUNCATE commands? (Choose two.)
A. DELETE can be used to remove only rows from only one table at a time.
B. DELETE can be used to remove only rows from multiple tables at a time.
C. DELETE can be used only on a table that is a parent of a referential integrity constraint. 父级的参照完整性约束错?
D. DELETE can be used to remove data from specific columns as well as complete rows. 指定行删除
E. DELETE and TRUNCATE can be used on a table that is a parent of a referential integrity constraint
having ON DELETE rule .
Answer: AE
答案解析:
A,DELETE一次只能用于移除一个表的行,正确
B,DELETE一次只能用于移除多个表的行,错误,一次只能一个表
C,DELETE只能用于删除有引用完整性约束的父表,错误,有完整性约束的父表不能被删除,除非禁用约束等
D,DELETE可以用于删除指定列的数据以及完整的行,错误,只能删除行,不能删除列
E,DELETE和TRUNCATE可以用于有引用完整性约束ON DELETE规则的父表。正确。
建表时可以使用ON DELETE CASCADE(当删除父表数据时,子表数据也一起删除)或ON DELETE CASCAD SET NULL(当删除父表数据时,子表相关的列设置为NULL)子句,可以在SQL Language Reference里的Constraints部分查找到ON DELETE子句