AI engineering glossary · SQL databases
What is GROUP BY?
GROUP BY: A clause that collects rows sharing the same value in the listed columns into groups, so an aggregate function can be computed for each group. Every selected column must be either grouped or aggregated.
GROUP BY: an example
SELECT city, COUNT(*) FROM customers GROUP BY city; returns one row per city with its customer count.
Related terms
More SQL databases terms
Where you learn it
GROUP BY is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.