更新前:cjb:
xsb:
使用sql语句更新后:
use pxscj
go
alter table cjb
add constraint xj_foreign2 foreign key (学号) references xsb (学号) on update cascade
go
use pxscj
go
update xsb set 学号='191320' where 学号='191301'
——————————————————————————
更新后:
xsb:
cjb:
书上说:使用 CASCADE 后从父表删除或更新时自动删除或更新子表中匹配的行
为什么我的表没有任何修改。
用
select * from xsb where 学号='191320'
却显示了: