SELECT COUNT(id) AS num, categoria FROM tabella GROUP BY categoria