SQL, lesson 4 of 6
Count and group
SQL can count and summarise. COUNT(*) counts rows. GROUP BY makes one row per group, so you can count within each group. AS names the new column:
SELECT paradigm, COUNT(*) AS total
FROM languages
GROUP BY paradigm;
That gives one row per paradigm, with how many languages are in it.
Your turn
For each paradigm, show the paradigm and how many languages use it, in a column named total. Order by paradigm.
Tables you can use
languages (name, year, paradigm, openings): one row per language. openings is the number of job openings, in thousands.
creators (language, creator): who created each language.
Press Run to see your results.
Hint: GROUP BY paradigm, select paradigm and COUNT(*) AS total, then ORDER BY paradigm.
The tutor gives hints, not finished answers. Log in to use it.