In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-10-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the use of SQL aggregation functions and sorting considerations, which have certain reference value, interested friends can refer to, I hope you have a lot of gains after reading this article, the following let Xiaobian take you to understand.
What are the considerations for using SQL aggregate functions and sorting?
count function
Grammar:
Select count(*)| count(column name) from table_name [where_definition];Select count(id) from stu;Select count(name) from stu where math > 90;select count (name) from stu where chines+math+English> 250;
sum function
Select sum (column name) from stu [where_definition];Select sum (column name),sum(column name), sum(column name) from stu [where_definition];Select sum (column name)+ sum (column name)+ sum(column name) from stu [where_definition];Select sum (column name)+sum(column name)+sum(column name) as Total score from stu [where_definition];Select sum (column name)/count(name) from stu [where_definition]; Select avg(math) from stu; Select avg(math + chines + english) from stu;Select max| min(column name) from stu;Select max(math + chines + english) from stu;Select min(math + chines + english) from stu;
Sort query results
Sort query results using the order by clause
Select column1, column2, column3 from table order by column asc|desc
Order by refers to the sorted column, or it can be the column name specified after select.
The order by clause should be at the end of the select statement
Select name, math from stu order by math;select name, math+english+chines from stu order by math+english+chines desc;select name, math+english+chines from stu where name like 'zhang%' order by math+english+chines desc;
Thank you for reading this article carefully. I hope that Xiaobian's "What are the precautions for using SQL aggregation functions and sorting" will be helpful to everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!
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
1. Query the current log group
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.