首页 > 其他 > 详细

update 表名 set ... where exiists ...

时间:2020-05-28 11:25:06      阅读:75      评论:0      收藏:0      [点我收藏+]

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 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 = ‘张三‘);

update 表名 set ... where exiists ...

原文:https://www.cnblogs.com/diandixingyun/p/12979177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!