Coding task · SQL and MySQL course · Module 6: Aggregation and grouping

The full song of aggregation

Combine everything: for available books, count them in each category, keep only categories with more than 5 books, and sort in descending order by count.

Task

Write a query that selects kategoria_id and COUNT(*) from the ksiazki table, takes only the rows where dostepna = 1, groups by kategoria_id, keeps the groups with COUNT(*) > 5, and sorts in descending order by COUNT(*).