且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我希望父表上的SQL查询更改自动反映在子表上

更新时间:2023-02-05 10:30:10

使用触发器.写一个 更新/删除Dept表上的触发器,以便如果deptnp列有任何更改,它也会对emp表进行更新.

Use Triggers. Write an Update/Delete trigger on the Dept table such that if there''s any change to the deptnp column, it does an update of the emp table as well.

 但通常不是保持更新/更改主键的好主意.仅当引用记录的数量增加时,才会产生影响.

 But it''s usually not a good idea to keep updating/changing primary keys. The impact will felt only when the number of referenced records go up.