Home > Database > Mysql Tutorial > mysql group query example analysis

mysql group query example analysis

WBOY
Release: 2023-05-30 20:46:04
forward
1188 people have browsed it

Explanation

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

Syntax

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

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;
Copy after login

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!

Related labels:
source:yisu.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