数据库表: class: teacher class与teacher是一对多 执行SQL: delete from teacher where t_id=1; 数据库的级联设置为: RESTRICT时 报错:a foreign key constraint fails 外键关联 这时需要先将class update class set teacher_id=null where c_id=1 NO A
数据库表:
class:
teacher
class与teacher是一对多
执行SQL:
delete from teacher where t_id=1;
数据库的级联设置为:
RESTRICT时
报错:a foreign key constraint fails 外键关联 这时需要先将class
update class set teacher_id=null where c_id=1
NO ACTION时
与上述一样
SET NULL时
teacher 删除,class中的teacher_id自动设置为null
CASCADE时
teacher中的内容删除,class中与关联的内容也删除
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号