下面我建两个表,并执行一系列sql语句,仔细观察sql执行后表中数据的变化,很容易就能理解多表联合更新的用法

student表                                                                         class表

1. 执行 UPDATE student s , class c SET s.class_name='test00',c.stu_name='test00' WHERE s.class_id = c.id

student表                                                                class表

2. 执行 UPDATE student s JOIN class c ON s.class_id = c.id SET s.class_name='test11',c.stu_name='test11'

student表                                                                  class表

3. 执行 UPDATE student s LEFT JOIN class c ON s.class_id = c.id SET s.class_name='test22',c.stu_name='test22'

student表                                                                      class表

4. 执行 UPDATE student s RIGHT JOIN class c ON s.class_id = c.id SET s.class_name='test33',c.stu_name='test33'

student表                                                                class表

5. 执行 UPDATE student s JOIN class c ON s.class_id = c.id SET s.class_name=c.name , c.stu_name=s.name

student表                                                                class表

原文地址:https://blog.csdn.net/u012604745/article/details/80642015

Mysql update多表联合更新的更多相关文章

  1. 书写 sql 中关于 update 多表联合更新的方法

    SQL Update多表联合更新的方法(1) sqlite 多表更新方法//----------------------------------update t1 set col1=t2.col1fr ...

  2. 170823、SQL Update多表联合更新的方法

    SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...

  3. SQL Update多表联合更新的方法

    SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...

  4. sql update多表联合更新

    update tabA set PrintTag=c.dp_state from tabA a inner join tabB b on a.Code=b.design inner join tabC ...

  5. mysql update 多表关联更新

    UPDATE new_schedules_spider_static_schedule s join new_scac_port p on p.`PORT` = s.`PORT` and p.SCAC ...

  6. 数据库:sql 多表联合更新【转】

    SQL Update多表联合更新的方法 (1) sqlite 多表更新方法 update t1 set col1=t2.col1 from table1 t1 inner join table2 t2 ...

  7. Oracle\MS SQL Server Update多表关联更新

    原文:Oracle\MS SQL Server Update多表关联更新 一条Update更新语句是不能更新多张表的,除非使用触发器隐含更新.而表的更新操作中,在很多情况下需要在表达式中引用要更新的表 ...

  8. MYSQL查看数据表最后更新时间

    MYSQL查看数据表最后更新时间 - 拨云见日 - CSDN博客 https://blog.csdn.net/warnerwu/article/details/73352774 mysql> S ...

  9. 一个MySQL中两表联合update的例子(并带有group by分组)

    内容简介 本文主要展示了在MySQL中,使用两表联合的方式来更新其中一个表字段值的SQL语句. 也就是update table1 join table2 on table1.col_name1=tab ...

随机推荐

  1. read函数和write函数

    read 函数 inline int read() { ,f=; char c=getchar(); ; c=getchar();} +c-'; c=getchar();} return f*x; } ...

  2. Supercharging your ETL with Airflow and Singer

    转自:https://www.stitchdata.com/blog/supercharging-etl-with-airflow-and-singer/ singer 团队关于singer 与air ...

  3. 因子分解机 FM

    特征组合 人工方式的特征工程,通常有两个问题: 特征爆炸 大量重要的特征组合都隐藏在数据中,无法被专家识别和设计 针对上述两个问题,广度模型和深度模型提供了不同的解决思路. 广度模型包括FM/FFM等 ...

  4. Harbor高可用

    项目需求: 实现Harbor的HTTPS高可用,由于Harbor 服务器配置不高,直接做HTTPS对上传下载镜像时,若docker客户端多时,会非常慢,为了提高harbor的效率,采用以下方式来解决. ...

  5. Centos pip 安装uwsgi 报错“fatal error: Python.h: No such file or directory”

    解决方法: 安装python-devel即可,注意,不是python-dev yum -y install python-devel

  6. nginx 访问控制之deny allow

    Nginx的deny和allow指令是由ngx_http_access_module模块提供,Nginx安装默认内置了该模块. 除非在安装时有指定 --without-http_access_modu ...

  7. UDS的使用

    我们通过对导热微分方程式的求解,并与Fluent自己的求解结果进行对比,介绍一下Fluent当中UDS(自定义标量)的具体使用方法. 首先Fluent当中的UDS主要针对下面这样形式的方程: 其中: ...

  8. 打包文件到APK安装包中

    打包文件到APK安装包中 目的:将配置文件或SQLITE打包进APK中 1.首先,打开菜单 Project - Deployment 2.点击添加按钮,选择要添加的文件(文件最好放在工程目录中,这样, ...

  9. 织梦Dedecms后台登陆密码忘记怎么办?

      有时候长期不登陆后台或则初次建站的新手常常忘记后台登陆密码,不过不用着急,早就有人写好了密码重设工具. 下载解压为radminpass.php, 通过FTP传到网站根目录,然后访问 http:// ...

  10. API调试工具--------Postman

    Postman一款非常流行的API调试工具.其实,开发人员用的更多.因为测试人员做接口测试会有更多选择,例如Jmeter.soapUI等.不过,对于开发过程中去调试接口,Postman确实足够的简单方 ...