SQL Query too add up how many times a unique string occurs
For example if I was creating a Pizza shop database 开发者_JAVA百科it would look like this
SELECT pizza_type, COUNT(*) as 'NumberOrdered'
FROM table
GROUP BY pizza_type
Look at the COUNT() function and GROUP BY
select pizza_type, count(*) as NumberOrdered
from orders
group by pizza_type
精彩评论