In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is the update sentence". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the update sentence"?
This time we are going to talk about the update statement in sql. At this point, there must be a lot of brothers dissatisfied, isn't it the update sentence? Who can't write, update table set column=expression [where search_condition].
But is the real update statement just like that? What is the essence of it? what is its principle? Let's use an example to illustrate:
Suppose you have a score sheet with only two fields, name and grade. How to use a sql statement to find out a student's name, score and ranking in the table?
Hehe, this question was posted by me last time. For details, please see https://www.jb51.net/article/53832.htm.
As a result, you can go there to watch. Now change the problem, suppose that this score table has three fields, name, score and ranking, now only the name and score are worth, how to update their ranking?
Some friends may propose a similar solution: first query it out with a query statement, and then update the ranking through cursors.
Is there a better solution? Of course there is, and the answer is to use the update statement.
Update score table set rank = (select count (*) + 1 from grade table where a. Achievement
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.