xxxxxxxxxx
GROUP BY is a clause in SQL that is used with aggregate functions.
It is used in collaboration with the SELECT statement to arrange
identical data into groups.
SELECT price, COUNT(*)
FROM fake_apps
GROUP BY price;
The GROUP BY statement comes after any WHERE statements,
but before ORDER BY or LIMIT.
xxxxxxxxxx
SELECT
column_1,
column_2,
,
aggregate_function(column_3)
FROM
table_name
GROUP BY
column_1,
column_2,
;
Code language: SQL (Structured Query Language) (sql)
xxxxxxxxxx
SELECT
brand,
segment,
SUM (quantity)
FROM
sales
GROUP BY
GROUPING SETS (
(brand, segment),
(brand),
(segment),
()
);
Code language: SQL (Structured Query Language) (sql)