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

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

藏色散人
藏色散人 Original
2020-05-16 09:45:29 6622browse

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!

Statement:
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