In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to update the data of the tables in the MySQL database, I believe most people do not know much about it, so share this article for your reference. I hope you will gain a lot after reading this article. Let's learn about it together.
The basic syntax of the Update statement:
UPDATE SET field 1 = value 1 [, field 2 = value 2... [WHERE clause] [ORDER BY clause] [LIMIT clause]
Used to specify the name of the table to update
SET clause: used to specify the column name to be modified in the table and its column value. Where each specified column value can be an expression or a default value for that column. If the default value is specified, the DEFAULT keyword is available to indicate the column value.
WHERE clause: optional. Used to limit the rows in the table to be modified. If not specified, all rows in the table are modified.
ORDER BY clause: optional. Used to limit the order in which rows in the table are modified.
LIMIT clause: optional. Used to limit the number of rows to be modified.
First, create a new database:
CREATE TABLE tasks (id INT NOT NULL, subject VARCHAR (45) NULL, start_date DATE NULL, end_date DATE NULL) charset utf8
Second, insert data:
Insert into tasks values (1 recorder mathmatis)
Finally, update the data:
UPDATE `tasks` SET `start_ date` = '2029-6-1', `end_ date` =' 2060-6-1' WHERE (`id` ='1') AND (`tast` = 'math') AND (`tasks` =' 0000-00') AND (`end_ date` = '0000-00') LIMIT 1
Note: make sure that the Update ends with the WHERE clause, and specify the conditions that the updated record needs to meet through the WHERE clause. If you omit the WHERE clause, MySQL will update all rows in the table.
The above is all the contents of the article "how to update the data of tables in MySQL database". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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: 0
*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.