当前位置:网站首页>MySQL batch update data
MySQL batch update data
2022-07-28 20:31:00 【Zi Feiyi】
The following sql It can be used to batch modify the data of two tables or the same table :
UPDATE table1 t1 INNER JOIN table2 t2 // t1 For the target table ,t2 For data source table
ON t1.name = t2.name // on The following is the connection condition of the two tables , Multiple conditions can be followed and、or etc.
SET t1.sex = t2.sex, // set The columns that need to be updated , Here is about t2 Tabular sex Update to t1 Tabular sex
t1.age= t2.age // Multiple columns can be updated at the same time , Separated by commas
WHERE t1.id > 1000 AND t1.id < 2000 // where The following is the scope to be updated
It is recommended to operate in the test library first when updating in batches , It is strictly forbidden to operate directly in the production environment , Do a good job of data backup , Keep in mind that ! Keep in mind that !!!
边栏推荐
- 七种轮询介绍(后附实践链接)
- Solve the problem that the nocturnal simulator cannot access the Internet after setting an agent
- Raspberry pie creation self start service
- 为什么客户支持对SaaS公司很重要?
- Linxu [basic instructions]
- Durham High Lord (classic DP)
- 【CodeForces】Educational Codeforces Round 132 (Rated for Div. 2)
- plt. What does it mean when linestyle, marker, color equals none in plot()
- Usage of const and assert
- Power Bi 2021 calendar DAX code
猜你喜欢
![[C language] use function pointers to make a different calculator](/img/58/e6ba11e054d9e45ec979224ac3e4c6.png)
[C language] use function pointers to make a different calculator

Leetcode-297 serialization and deserialization of binary tree

Data mining (data preprocessing) -- Notes

Merge sort template

[dynamic link library (DLL) initialization example program failed "problem]
![[task02: SQL basic query and sorting]](/img/10/c2a936c882cd77f422396840282ed5.png)
[task02: SQL basic query and sorting]

Wust-ctf2021-re school match WP

Configure Windows Server + install MySQL database on the server + Remote Access database

Dsactf July re

C language - data storage
随机推荐
Tree row expression
Pop up modal box
C language - data type
上海交大牵手淘宝成立媒体计算实验室:推动视频超分等关键技术发展
Reverse string
Gru neural network
5. Difference between break and continue (easy to understand version)
4. Const and difine and the problem of initializing arrays with const and define
C语言数据 3(1)
Read JSON configuration file to realize data-driven testing
Wildcard ssl/tls certificate
[task03: complex query methods - views, subqueries, functions, etc.]
Linxu 【基本指令】
Store and guarantee rancher data based on Minio objects
How to automatically store email attachments in SharePoint
WPF--实现WebSocket服务端
One article makes you understand what typescript is
File lookup and file permissions
[link url]
Power Bi 2021 calendar DAX code