Coding task · SQL and MySQL course · Module 8: Subqueries

Average number of books per author

Place a subquery in the FROM clause as a derived table and compute the average from it.

Task

Write a query that computes the average (AVG) number of books per author. In the FROM clause place a subquery that returns autor_id and COUNT(*) AS liczba from the ksiazki table, grouped by autor_id. Give this derived table the alias zestawienie. In the outer query compute AVG(liczba).