Home >Database >SQL >What is the meaning of group by in sql query

What is the meaning of group by in sql query

hzc
hzcOriginal
2020-07-02 17:19:5422941browse

The meaning of group by in SQL query is to combine the total function to group the result set according to one or more columns. Its function is to divide a data set into several small ones through certain rules. area, and then perform data processing on several small areas.

What is the meaning of group by in sql query

1. The group by in the sql statement is: The GROUP BY statement is used to combine the total function to group the result set according to one or more columns.

2. Advanced syntax of sql statement group by:

1. Write a sql statement to create a table. Of course, we can also create it with a design drawing;

What is the meaning of group by in sql query

2. Select * from student, we enter a query statement to display all the data we just inserted;

What is the meaning of group by in sql query

3. select stuname, COUNT(*) from student group by student. From the above results, it is not difficult to see that we have grouped students according to their names. Another way to say it is to filter out the duplicates, group the name column in the student table with group by, and use the aggregate function (count) to make statistics. The number of occurrences of each name.

What is the meaning of group by in sql query

#There are many techniques in Sql statements. Generally, in addition to the addition, deletion, modification and query when we first learn, there are many others. When installing, be sure to remember to check the bitrate of your operating system. If you have a 32-bit operating system, install a 32-bit Sqlserver version. There is no limit on the version, either 2005 or 2012.

Recommended tutorial: "sql tutorial"

The above is the detailed content of What is the meaning of group by in sql query. 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