--创建触发器
delimiter //
create trigger 触发器名 before(after) insert(update,delete) on t1 for each row
begin
declare a varchar(20);
declare b varchar(20);
set a=(select name from student);
set b=(select name from sanban);
insert into t(name1,name2) values(a,b);
end//
delimiter ;
原文:https://www.cnblogs.com/luckiness/p/13089231.html