Это даст вам строку для каждой категории.
SELECT category, COUNT(*) as catcount
FROM YourTable
GROUP BY category
Чтобы получить вывод в указанном вами формате (1 строка, 4 столбца):
SELECT SUM(CASE WHEN category = 0 THEN 1 ELSE 0 END) AS cat0count,
SUM(CASE WHEN category = 1 THEN 1 ELSE 0 END) AS cat1count,
SUM(CASE WHEN category = 2 THEN 1 ELSE 0 END) AS cat2count,
SUM(CASE WHEN category = 3 THEN 1 ELSE 0 END) AS cat3count
FROM YourTable