自动删除选修表SC中该学生的成绩记录?
MSSQL:首先你的学号在SC的外键必须是 on delete cascadealter table scadd constraint fk_test foreign key (学号) references s(学号) on delete cascadecreate trigger test on safter deleteasbegindelete from sc where 学号 in (select 学号 from deleted)endOracle:create or replace trigger testafter delete on sfor each rowbegindelete from sc where 学号=:old.学号;end;SQL语法DELIMITER |CREATE TRIGGER `
Copyright © 广州京杭网络科技有限公司 2005-2024 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有