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.
我有这个任务来模拟一个带有触发器的引用动作。任务本身是:举例说明如何使用触发器来模拟引用动作。
我知道使用触发器和引用操作很热门,但结合起来我真的不明白,问题本身。
鉴于您列出的最不令人反感的选项是在删除父行时执行级联删除
CREATE OR REPLACE TRIGGER trigger_name AFTER DELETE ON parent_table FOR EACH ROW BEGIN DELETE FROM child_table WHERE parent_id = :old.parent_id; <<repeat for each child table>> END;