91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

通過觸發器分發同步數據

發布時間:2020-08-12 16:26:07 來源:ITPUB博客 閱讀:117 作者:wzgchen 欄目:MySQL數據庫
通過觸發器分發同步數據


create table tab(id int not null primary key,name varchar(20),age int,address varchar(200));
create table tab0(id int not null primary key,name varchar(20),age int,address varchar(200));
create table tab1(id int not null primary key,name varchar(20),age int,address varchar(200));
create table tab2(id int not null primary key,name varchar(20),age int,address varchar(200));




insert into tab values(1,'chen',30,'shanghai');
insert into tab values(2,'jiang',40,'shanghai');
insert into tab values(3,'wang',31,'shanghai');






delimiter //
create trigger tri_sync_insert
  after insert on tab
for each row
begin
declare
v_result int;
set v_result=mod(new.id,3);
if v_result =0 then
insert into tab0(id,name,age,address) values(new.id,new.name,new.age,new.address);
elseif v_result = 1 then
insert into tab1(id,name,age,address) values(new.id,new.name,new.age,new.address);
else
insert into tab2(id,name,age,address) values(new.id,new.name,new.age,new.address);
end if;
end;
//
delimiter ;




delimiter //
create trigger tri_sync_update
  after update on tab
for each row
begin
declare
v_result int;
set v_result=mod(new.id,3);
if v_result =0 then
replace into tab0(id,name,age,address) values(new.id,new.name,new.age,new.address);
elseif v_result = 1 then
replace into tab1(id,name,age,address) values(new.id,new.name,new.age,new.address);
else
replace into tab2(id,name,age,address) values(new.id,new.name,new.age,new.address);
end if;
end;
//
delimiter ;




delimiter //
create trigger tri_sync_delete
  after delete on tab
for each row
begin
declare
v_result int;
set v_result=mod(old.id,3);
if v_result =0 then
delete from tab0 where id=old.id;
elseif v_result = 1 then
delete from tab1 where id=old.id;
else
delete from tab2 where id=old.id;
end if;
end;
//
delimiter ;

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

竹北市| 澜沧| 屯留县| 南木林县| 通山县| 常德市| 镇巴县| 遵义市| 乌恰县| 贵德县| 鹰潭市| 镇雄县| 丹寨县| 诸暨市| 井研县| 莲花县| 长寿区| 河南省| 多伦县| 泊头市| 江津市| 元阳县| 彰化县| 吉安县| 陆河县| 咸丰县| 巴东县| 增城市| 绵竹市| 彩票| 沙洋县| 合阳县| 兴化市| 闻喜县| 榕江县| 阳谷县| 江口县| 乌什县| 行唐县| 巴彦县| 保德县|