Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief Analysis of five aggregate functions of MySQL

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly gives you a brief introduction to the five aggregate functions of MySQL. You can look up the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic of brief analysis of the five aggregate functions of MySQL. I hope we can bring you some practical help.

In order to get statistics quickly, five aggregate functions are provided.

* count () indicates that the total number of rows is calculated, and the star and column names are written in parentheses. The result is the same * *

Inquire about the total number of students

Select count (*) from students

Max (column) means to find the maximum value of this column

Query the maximum number of girls

Select max (id) from students where gender=0

Min (column) means to find the minimum value of this column

Query the minimum number of undeleted students

Select min (id) from students where isdelete=0

Subquery

Select * from students where id= (select min (id) from students where isdelete=0)

Sum (column) represents the sum of this column

After querying the boy's number

Select sum (id) from students where gender=1

Avg (column) means to find the average of this column.

Query the average number of undeleted girls

Select avg (id) from students where isdelete=0 and gender=0

This is the end of the brief analysis of the five aggregate functions of MySQL. If you want to know about other related issues, you can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report