update 表名 set ... where exiists ...
1、常用
语法结构:update 表名 set 列名1=值1,列名2=值2,列名3=值3..... where 条件
update student t
set t.age = '24', t.idnumber = '3503021994XXXXXXXX' where t.stuname = '张三';2、备份表
语法结构:
update 表1 set 列名=(select 列名 from 表2 where 表1.列名=表2.列名)
where exists (select 1 from 表2 where 表1.列名=表2.列名)例子:
update student.stuinfo t
set (age, idnumber) = (select age, idnumber from student.stuinfo_2018 b where b.stuid = t.stuid) where exists (select 1 from student.stuinfo_2018 b where b.stuid = t.stuid and b.stuname = '张三');
学习时的痛苦是暂时的,未学到的痛苦是终生的

浙公网安备 33010602011771号