10.请把这个数据库spl语句详细解释一下,明天老师要讲解,讲的对就给分

来源:百度知道 编辑:UC知道 时间:2024/06/03 20:43:44
create trigger tri_insert
on student for insert,update
as if exists (select sdept from inserted)
begin print 'you can not update the date'
rollback
end

update student set sdept='数学家'
where sdept='数学系'

建立一个叫作tri_insert的触发器在学生表中

当更新或者插入学生表的时候触发

如果插入或更新的sdept值已经存在
则输出:'you can not update the date'

然后回滚

呵呵,其实我也想找一些练习做做看

Q:834331524

验证信息:数据库

在student 表上创建一个名称为tri_insert 的触发器,如果插入或更新的sdept值已经存在,则不允许操作。不知道这样对不对,共同学习 ,呵呵