Problem
Product catalogues are organized by category, and understanding how inventory is distributed helps buying teams decide where to expand or trim the assortment. Category managers run this query regularly to spot over-stocked categories and gaps that need new products. Using the products table, return category and product_count, ordered from most to fewest products.
Schema
products
| column | type |
|---|
| id | INTEGER |
| name | TEXT |
| category | TEXT |
| price | NUMERIC |
Sample Data
| id | name | category | price |
|---|
| 1 | Widget | Tools | 9.99 |
| 2 | Gadget | Electronics | 149.99 |
| 3 | Gizmo | Electronics | 79.99 |
| 4 | Doohickey | Tools | 24.99 |
| 5 | Bracelet | Accessories | 19.99 |
| 6 | Wrench | Tools | 14.99 |
Expected Output
| category | product_count |
|---|
| Tools | 3 |
| Electronics | 2 |
| Accessories | 1 |