Coding task · SQL and MySQL course · Module 6: Aggregation and grouping
Categories sorted by book count
Count the books in each category and sort the result from the most numerous category. Combine GROUP BY with ORDER BY.
Task
Write a query that selects kategoria_id and COUNT(*) from the ksiazki table, groups by kategoria_id, and sorts the result in descending order by COUNT(*) (ORDER BY COUNT(*) DESC).