Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use group by in SQL

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use group by in SQL. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Group_by means grouping data according to which fields or which fields are grouped according to by. "Group By" literally means grouping data according to the rules specified by "By". The so-called grouping is to divide a "data set" into several "small areas" and then process the data for a number of "small areas".

The syntax structure is as follows:

Select field from table name where condition group by field or select field from table name group by field having filter condition

Note: for filter conditions, you can use where first, then group by, or group by first, then having

Original table

Simple Group By

Example 1

Select category, sum (quantity) the sum of as

From A

Group by category

The returned results are shown in the table below, which is actually a categorized summary.

On the use of group by in SQL to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report