SQLGROUP BYaggregationtutorial
What is GROUP BY in SQL? Grouping rows for beginners
GROUP BY is the SQL command for "collapse rows into groups and aggregate". Plain words: how to get "how many orders each customer has" in a single query. What you can and can't put in SELECT, the difference from DISTINCT, GROUP BY on multiple columns, and common pitfalls.
PreviousWhat are COUNT, SUM, AVG, MIN, MAX in SQL? Aggregate functions for beginnersNextWhat is HAVING in SQL? Filtering groups for beginners
Related articles
Tasks on this topic
Paid Events Across CitiesWhich Platform Converts BestWhat Cities View and BuyPlatforms That Saw a PaymentWhen Kotomarket Comes AliveUser activity: views and purchases
All problems on this topic →
GROUP BYis the SQL command for "collapse identical rows into one and aggregate them". The basic way to get stats: how many orders each customer has, total sales per product, average salary per department.This article is currently in Russian. The full English translation is on the way.