導航:首頁 > 編程大全 > 按照資料庫b來更新資料庫a

按照資料庫b來更新資料庫a

發布時間:2023-06-04 04:23:31

Ⅰ SQL資料庫中如何從A表自動更新數據到B表

要實現兩個表之間的數據的自動更新,可以採用觸發器來實現,觸發器的實現方法版:
1、A表有數據更新權的時候自動更新B表:
create or replace trigger tg after update on A for each row
begin
update B set xx=xx where b.aid = a.id;
end;
/
2、A表插入數據時,B表更新數據:
create or replace trigger tgg after insert on A for each row
begin
insert B values(xxxx);
end;
/
如果不需要每條數據都跟新,只需要在每次A更新的時候更新B,可以將後面的for each row去掉。

Ⅱ Mysql跨資料庫更新

Mysql跨資料庫更新
update a.tabble1,b.table2 set a.online = 1 where table1.time = b.table2.time

Ⅲ SQL間的兩個資料庫表的同步更新

可以利用觸發器實現,在insert 觸發器中,使用inserted表根據你的條件,將數據分別保存在不同的表中
insert b1
select * from inserted
where datepart(mm,datefield)= 1
insert b2
select * from inserted
where datepart(mm,datefield)= 2

Ⅳ sql中用另一個表的一列來更新資料庫表

merge into a
using b
on(a.主鍵=b.主鍵)
when matched then
update set a.c=b.d

閱讀全文

與按照資料庫b來更新資料庫a相關的資料

熱點內容
我不會英語怎麼編程 瀏覽:895
c盤和文件大小 瀏覽:63
maya工具架怎麼調出來 瀏覽:191
文件系統壞了怎麼辦 瀏覽:261
小公司網路布線 瀏覽:515
怎麼用二維碼編程 瀏覽:341
f9b文件能用手機看嗎 瀏覽:364
手機暴風視頻文件夾 瀏覽:394
vsftpdlinux下載文件 瀏覽:948
文件名修改後快捷方式還可以用嗎 瀏覽:387
親密愛人qq相冊名字 瀏覽:884
怎麼修改手機原始密碼 瀏覽:230
榆次網站優化怎麼樣 瀏覽:537
vb窗體文件如何打開 瀏覽:810
百度找圖怎麼跳轉網站 瀏覽:284
安卓44如何隱藏文件夾 瀏覽:92
sr100怎麼編程序 瀏覽:795
蘋果手機怎樣保存信息 瀏覽:379
安卓patch是什麼文件 瀏覽:819
2003word審閱 瀏覽:387

友情鏈接