Home > Database > SQL > What are the command phrases used for grouping in database queries?

What are the command phrases used for grouping in database queries?

藏色散人
Release: 2020-05-16 09:45:29
Original
6767 people have browsed it

What are the command phrases used for grouping in database queries?

What are the command phrases that need to be used for grouping in database queries?

The phrase used in SQL to implement grouping queries is "GROUP BY".

HAVING cannot exist independently from the GROUP BY phrase; ASC cannot exist independently from the ORDERBY phrase.

The phrase that implements group query is GROUPBY. The GROUP BY phrase is used to group query results and can be used for group summary.

ORDERBY phrase is used to sort the final query results;

HAVING phrase is used to limit the grouping conditions;

ASC is used to limit sorting in ascending order of the specified attribute value . If the HAVING phrase is required, the HAVING phrase must appear after the GROUPBY phrase. If the ASC (DESC descending order) phrase is required, it must appear after the ORDER BY phrase. Usually the GROUPBY phrase appears before the ORDER BY phrase.

Recommended: "SQL Tutorial"

The above is the detailed content of What are the command phrases used for grouping in database queries?. For more information, please follow other related articles on the PHP Chinese website!

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