Home  >  Article  >  Database  >  mysql group query example analysis

mysql group query example analysis

WBOY
WBOYforward
2023-05-30 20:46:041143browse

Explanation

1. You can use the group by clause to divide the data in the table into several groups.

Syntax

select 查询的字段,分组函数
from 表
group by 分组的字段

2. Features

Can be grouped by a single field

With the grouping function It is best to query the fields after grouping

Group filtering

Example

SELECT
  MAX(salary),
  job_id
FROM
  employees
GROUP BY job_id;

The above is the detailed content of mysql group query example analysis. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete