Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果主表的主键被其他表中的外键引用,应该遵循哪种方法来删除主表?
我知道关于删除级联,还有其他方法吗?这是最佳实践
谢谢
此 DDL 语句将删除一个表,删除任何引用它的外键。
drop table your_master_table cascade constraints /
编辑
上述语法适用于 Oracle 和 SQL Server。如果您遇到语法错误,您将需要查阅 SQL 参考以了解您的数据库风格。