Let\'s say I need to have the ratio of "number of items available from certain category" to "the number of all items". Please consider a
This should do it:
SELECT I.category AS category, COUNT(*) AS items, COUNT(*) / T.total * 100 AS percent FROM Item as I, (SELECT COUNT(*) AS total FROM Item WHERE Department='Popular') AS T WHERE Department='Popular' GROUP BY category;