All courses › Databases, Networks and Security › JOIN and GROUP BY
JOIN and GROUP BY
JOIN combines rows from two tables where the keys match. GROUP BY collects rows with the same value, so that aggregate functions like COUNT, SUM and AVG are computed per group. HAVING filters the groups afterwards.
link tables
average per course
Symbols
| aggregate functions | ||
| filter on groups |
Example
Exams in MAT (4) and PHY (2):
gives MAT 4 and PHY 2.
WHERE filters rows before grouping, HAVING filters groups after.
Practise relational databases and SQL for free →
← SELECT and WHERE · IP addresses →
Part of Databases, Networks and Security: Relational databases and SQL.