SELECT count(*) FROM items;
SELECT * FROM items WHERE course = 'main';
SELECT name FROM items WHERE course = 'main';
SELECT max(revenue), min(revenue) from items WHERE course = 'main';
SELECT sum(revenue) from items WHERE course = 'main';
SELECT * FROM items
WHERE revenue >
(SELECT AVG(revenue) FROM items);
SELECT SUM(i.revenue)
FROM items i
INNER JOIN items_categories ic
ON i.id = ic.item_id
INNER JOIN categories c
ON c.id = ic.category_id
WHERE c.name = 'dinner';
SELECT c.name, SUM(i.revenue)
FROM categories c
INNER JOIN items_categories ic
ON c.id = ic.category_id
INNER JOIN items i
ON i.id = ic.item_id
GROUP BY c.name;