In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First of all, where is for a single statement and having is for groups. And the priority is where > group by > having.
It is important to note that:
1.where cannot be put after group by.
2.having is used with group by and is put after group by
Functions cannot be aggregated after 3.where, that is, SUM (), AVG (), and so on. Having can.
Aggregate function:
Aggregate functions are statistical functions. Such as summation, average, maximum and minimum, and so on. Group by can act on these statistical functions on a set of data. For example, if I need to ask for the average of each stage, I need to classify each stage and then average it. Of course, where can also meet the requirements.
In the query, the priority of the aggregate statement (aggregate function) is higher than that of having (that is, it is classified first in statistics), and the priority of the aggregate statement is lower than where (), that is, it is filtered individually and then counted. For example, we need to screen for departments that are less than 20% and whose total salary is greater than 10000. Then:
Select department_id, sum (salary) from groupwhere department_id
< 20 group by department_idhaving sum(salary) >10000
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.