Quite simple stuff. Count the items in a category.
SELECT COUNT(*) FROM items WHERE category_id = 12;
That would give you the number of items from items table where category_id is 12. You could also place that count to the same sql as subquery where you list the categories.