以前只知道用drop table 删除一个表,在看"An Introduction to database systems"时才发现其实还可以更一个选项RESTRICT/CASCADE。数据库这门课真是有很多东西值得去学,就连常用的SQL还有好多我都不会啊!
An existing table can be dropped by means of DROP TABLE --sytanx:
DROP TABLE
;
where is either RESTRICT or CASCADE. If RESTRICT is specified and the table is referenced in any view definition or integrity constraint, the DROP will fail; if CASCADE is specified, the DROP will succeed(dropping the table and deleting all of it's rows), and any referencing view definitions and integrity constraints will be dropped also.
没有评论:
发表评论