触发器

--创建成功的触发器
create trigger trig_insert
on population_tab
after insert
as
begin
declare @salary int;
select @salary = (select b.population from population_tab b
where b.pop_id = (select max(a.pop_id) from population_tab a));
if not exists (select * from salary_tab c where c.before_salary = @salary)
insert into salary_tab(before_salary,after_salary) values(@salary,@salary);
end

上一篇:MySQL基础


下一篇:4.SQL基础应用