GROUP BY
Groups rows with the same values into summary rows, used with aggregate functions.
Syntax
sql
SELECT col, AGG_FUNC(col) FROM table GROUP BY col;Example
sql
SELECT category, COUNT(*) AS count, AVG(price)
FROM products
GROUP BY category
HAVING COUNT(*) > 5;