当前位置:网站首页>SQL update batch update
SQL update batch update
2022-06-27 18:36:00 【Ink Sky Wheel】
First review ,sql update Statement is used to modify data in a table .
grammar :
UPDATE The name of the table SET Column name = The new value WHERE Column name = Certain value
SQL update Batch update instance
1、 Through the same table update Copy column to another column , As shown in the figure below , Add columns to the original table score2, And score Copy the value of

update student set score2= score
Output results

What if the data of different tables are updated ? How to operate ? Please look down ~
2、 Under special circumstances , A table needs to add a column foreign key to another table ( It could be a table from another library ) relation , This situation has no relevance , We often use paper-based materials to make spreadsheets and then temporary tables to update relational data in batches
Such as student surface , You need to add columns grade_id

Another temporary table Grade surface ( It may be a temporary table imported from a spreadsheet ) as follows :

Current demand in student Added to the table Grade_id Corresponding assignment , The statement is as follows :
update studentset grade_id = (select grade_id from grade a where a.student_id=student.id)where student.id in (select student_id from grade)
The output is as follows :

update There are risks , Be careful in operation ! friends
Get to know the database together
SQL Server2014 Installation picture and text explanation
Mysql Installation picture and text explanation ! Teach you from download to installation
Oracle Installation picture and text explanation ! Teach you from download to installation

边栏推荐
- Common optimization techniques for Web Performance
- Part 30 supplement (30) ECMAScript object
- 数据同步工具 DataX 已经正式支持读写 TDengine
- About binary
- Software testing learning - dark horse programmer, software testing learning outline
- [qt learning notes]qt uses MFC compilation to generate DLL libraries. The problem that DLL cannot be loaded occurs on computers without programming environment
- 银河麒麟V10系统激活
- Asemi rectifier bridge kbp310 function pin diagram
- The data synchronization tool dataX has officially supported reading and writing tdengine
- [UVM basics] set a monitor at the input port of the DUT to explain the necessity
猜你喜欢

Anfulai embedded weekly report (issue 252): February 7, 2022 to February 13, 2022

Allocate aligned heap space

Leetcode 5. Longest Palindromic Substring

Sword finger offer 22 The penultimate node in the linked list
![[Tang Laoshi] C -- encapsulation: member method](/img/47/9a4ffd787624f6208b6aee66c38b48.jpg)
[Tang Laoshi] C -- encapsulation: member method

Wechat applet association search

Tdengine connector goes online Google Data Studio store

软件测试学习-黑马程序员,软件测试学习大纲

建立自己的网站(10)

Push NFT out of the regulatory dilemma, and BSN launched NFT supporting infrastructure network
随机推荐
About binary
[JS reverse hundreds of examples] I love to solve 2022 Spring Festival problems and receive red envelopes
「技术课堂」如何用 VSCode 从 0 到 1 改写 TDengine 代码
Awk determines whether the first column is greater than 1. If it is greater than 1, the row will be printed
Contest3182 - the 39th individual training match for 2021 freshmen_ F: ss
[UVM foundation] UVM_ Is in agent_ Active variable definition
SQLite net (SQLite is used by unity, WPF and WinForm)
新产品新人事新服务,英菲尼迪继续深耕中国未来可期!
【ELT.ZIP】OpenHarmony啃论文俱乐部—见证文件压缩系统EROFS
Asemi rectifier bridge kbp210 parameters, kbp210 specifications, kbp210 dimensions
OpenSSF 安全计划:SBOM 将驱动软件供应链安全
Application of scaleflux CSD 2000 in Ctrip
[elt.zip] openharmony paper Club - witness file compression system erofs
[leetcode] 2. Add two numbers (user-defined listnode), medium
Seata server database connection user and service database undo_ What permissions do log users need?
[UVM foundation] build of UVM_ Phase execution sequence
实现时序数据库(Time Series Database)在特定场景下“远超”通用数据库的难点
Daily leetcode force deduction (31~35)
Explain the distributed computing of Apache skywalking OAP in detail
09 route guard authenticates URL