Home > Database > Mysql Tutorial > body text

How to use Groups function in MySQL SELECT clause?

王林
Release: 2023-09-12 17:37:02
forward
743 people have browsed it

如何在 MySQL SELECT 子句中使用 Groups 函数?

We know that group functions operate on sets of values, that is why if group functions are used in SELECT clause, then they will be used for rows that satisfy the query selection criteria and The output of the group function will be returned as the output of the query.

Example

In the following example, we have used some group functions in the SELECT statement. The fields of the "Student" table and the output of the statement are the output of these group functions-

mysql> Select COUNT(Name), MIN(Id), AVG(Id), MAX(Id), COUNT(*) from Student;
+-------------+---------+---------+---------+----------+
| COUNT(Name) | MIN(Id) | AVG(Id) | MAX(Id) | COUNT(*) |
+-------------+---------+---------+---------+----------+
| 5           | 1       | 11.0000 | 20      | 5        |
+-------------+---------+---------+---------+----------+
1 row in set (0.03 sec)
Copy after login

The above is the detailed content of How to use Groups function in MySQL SELECT clause?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!