In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Group by is generally used with aggregate functions such as count,sum,avg, etc.
Use after select, such as: select * from test where (condition) group by (condition)
If you are in the return set field, these fields are either included at the end of the Group By statement as a basis for grouping, or they are included in the aggregate function.
By the way, the order of the fields after Group By is higher than that of the grouped fields near Group By, and then decreases in turn. Such as: Group By Column1, Column2, Column3. Then the order of grouping levels from high to low is: Column1 > Column2 > Column3
The execution order of 2Group By and Having, Where, Order by statements:
Finally, I would like to explain the execution order of Group By, Having, Where and Order by statements. A SQL statement often produces multiple temporary views, so the order in which these keywords are executed is important because you have to know whether the keyword operates on the field before the corresponding view is formed or on the resulting temporary view, which is especially important in views that use aliases. The keywords listed above are executed in the following order: Where, Group By, Having, Order by. First of all, where deletes the records that do not meet the conditions in the original records (so the records that do not meet the conditions should be filtered out as far as possible in the where statement, so as to reduce the number of grouping), then the filtered views are grouped by the grouping conditions specified after the Group By keyword, and then the records that do not meet the conditions are filtered out according to the filter criteria specified after the Having keyword. The views are then sorted according to the Order By statement, and the final result is produced. Of these four keywords, the column name of the final view can be used only in the Order By statement.
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.