In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the method of sql to modify the contents of the table, I hope you will learn a lot after reading this article, let's discuss it together!
There are three ways to modify the contents of tables in sql: using SSMS database management tools to modify contents, using T-SQL scripts to modify contents, and multi-table association to modify table contents, etc.
Modify data using SSMS database management tools
You can modify any one or more of them.
1: open the database, select the data table, right-click-"Edit all rows (if not configured, click Edit the first 200 rows).
2. Edit the data that needs to be modified-"after editing, right-click on the blank space -" Select to execute SQL to edit successfully.
Use T-SQL scripts to modify data
Modify single-column or multi-column data in a single table
Syntax: update table name set column name 1 = value, column name 2 = value where condition
Example 1:
Update test1 set age='21' where id='1'
Example result:
Modify multiple rows, one column or multiple columns of data in a single table
Syntax: update top (quantity) table name set column name 1 = value, column name 2 = value 2 where condition
Example:
Update test1 set age='23' where id in ('1million and 2'); update test1 set age='22' where id between' 3' and '4update test1 set age='23' where id > =' 5' and id = '5toy update test1 set age='23' where test1.id in (select top (2) id from test1 order by id desc)
Example result:
Multi-table association modifies data in the table
Syntax: update Table 1 set Table 1. Column 1 = value, Table 1. Column 2 = value from Table 1 as a, Table 2 as b where a. Column name = b. Column name
Example:
Update test1 set test1.name=' Li Hua', test1.sex=' female 'from test1 as an as b where a.classid=b.id Test2
Example result:
After reading this article, I believe you have a certain understanding of the method of sql to modify the contents of the table, want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 272
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.