In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the four aggregation functions of MySQL, the contents of the article are carefully selected and edited by the author, with a certain pertinence, the reference significance for you is still relatively great, the following with the author to understand the four aggregation functions of MySQL.
1.count aggregate function, which is used to count functions
(1) count the number of students in a class
Select count (*) from grade
(2) Statistics on the number of students whose math scores are greater than 70
Select count (*) from grade where math > 70
(3) the number of people whose total statistical score is greater than 230
Select count (*) from grade where chinese+math+english > 230
2.sum aggregate function to find the sum of a column that meets the condition
(1) Statistics of the total math scores of a class
Select sum (math) from grade
(2) Statistics of the total scores of Chinese, math, English and other subjects in a class.
Select sum (chinese), sum (math), sum (english) from grade
(3) Statistics of the total scores of a class in Chinese, maths, English and
Select sum (chinese+math+english) from grade
(4) Statistics of the average score of a class in Chinese.
Select sum (chinese) / count (*) from grade
3.avg aggregate function to find the average of columns that meet the condition
(1) find the average score of mathematics in a class.
Select avg (math) from grade
(2) find the average total score of a class.
Select avg (chinese+math+english) from grade
4.MAX / MIX aggregate function to find the maximum and minimum values of the columns of compound conditions
(1) seek the highest and lowest scores of the class.
Select max (chinese+math+english) from grade
Select min (chinese+math+english) from grade
After reading the above four aggregate functions about MySQL, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.
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.