〇、概述
1、资料
sql连表删除:http://www.lanxinbase.com/?tag=sql%E8%BF%9E%E8%A1%A8%E5%88%A0%E9%99%A4
sql实现两表关联更新:https://blog.csdn.net/qq_43429919/article/details/124036257
2、组成
一、更新操作
(一)传统方式
Update student Set Sage=22
Where Sno=’201215121’;
(二)连表方式
1、pgsql
UPDATE (要更新的表) table1 t1
SET t1.字段1 = t2.字段1, t1.字段2 = t2.字段2,
FROM
(数据来源表) table2 t2
WHERE
t1.key = t2.key
2、MySQL
UPDATE (要更新的表) table1 t1, table2 t2
SET t1.字段1 = t2.字段1, t1.字段2 = t2.字段2,
WHERE
t1.key = t2.key
二、删除操作
(一)传统方式
Delete From SC Where Son in(
Selete Sno From Student
Where Sdept=’CS’);
(二)连表方式
delete FROM `t1` using `t1`
left join `t2` on t1.id= t2.id
where 1 and t2.id is null;
标签:删除,t2,更新,t1,连表,字段,SQL From: https://www.cnblogs.com/liujinhui/p/16589961.html