当前位置:网站首页>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 student
set 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

边栏推荐
- Explain the distributed computing of Apache skywalking OAP in detail
- leetcode 70. climb stairs
- Leetcode 704. Binary search
- Leetcode 46 Full Permutation
- About binary
- Wechat applet payment countdown
- ansible环境安装及数据恢复
- Defiato is an innovation that combines user-friendly features of a centralized platform with defi services
- 09 route guard authenticates URL
- Software testing learning - dark horse programmer, software testing learning outline
猜你喜欢
Optimal binary search tree
[Tang Laoshi] C -- encapsulation: member method
Sword finger offer 22 The penultimate node in the linked list
How much room does Migu video have for development without relying on sports events?
Computing trends in three times of machine learning
Synchronization mechanism of dual namenodes
09 route guard authenticates URL
Overview of Inspur Yunxi database executor
Offline disk group
All you want to know about large screen visualization is here
随机推荐
Wanzhou gold industry: what are the differences between gold t+d investment and other investments?
CDH cluster installation
Leetcode 5. Longest Palindromic Substring
为什么要从 OpenTSDB 迁移到 TDengine
Sword finger offer 22 The penultimate node in the linked list
Oracle TRUNC function processing date format
1. introduction to MariaDB
About binary
Wechat applet payment countdown
The power of code refactoring: how to measure the success of refactoring
TP5 generates the most detailed two-dimensional code tp6 (also available)
WOx WPM installing the Youdao plug-in
Teach you to use elastic search: run the first hello world search command
leetcode 69. Square root of X
Part 32 supplement (32) string of ECMAScript
[UVM basics] set a monitor at the input port of the DUT to explain the necessity
TDengine 连接器上线 Google Data Studio 应用商店
国内首家!EMQ加入亚马逊云科技“初创加速-全球合作伙伴网络计划”
wheel ui
Alibaba cloud server is invaded