Learn / SQL / Averages and ROUND

SQL, lesson 5 of 6

Averages and ROUND

More summaries: SUM, AVG (average), MIN and MAX. Averages often have long decimals, so ROUND(value, places) tidies them:

SELECT paradigm, ROUND(AVG(openings), 1) AS avg_openings
FROM languages
GROUP BY paradigm;

ROUND(x, 1) keeps 1 decimal place.

Your turn

For each paradigm, show the paradigm and the average of openings rounded to 1 decimal place, in a column named avg_openings. 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.