Month-end count at the shop: how many items are left in each category? Add up the stock of each category. Two columns: the category, and its total stock.
| id | name | category | price | stock |
|---|---|---|---|---|
| 1 | Milk tea | drink | 12 | 30 |
| 2 | Lemon water | drink | 8 | 50 |
| 3 | Cheesecake | cake | 25 | 6 |
| 4 | Cookie | snack | 5 | 80 |
| 5 | Brownie | cake | 18 | 0 |
| 6 | Iced coffee | drink | 15 | 20 |
| 7 | Chips | snack | 7 | 40 |
| 8 | Fruit tart | cake | 28 | 4 |
| id | name | category | price | stock |
|---|---|---|---|---|
| 1 | Milk tea | drink | 12 | 30 |
| 2 | Lemon water | drink | 8 | 50 |
| 3 | Cheesecake | cake | 25 | 6 |
| 4 | Cookie | snack | 5 | 80 |
| 5 | Brownie | cake | 18 | 0 |
| 6 | Iced coffee | drink | 15 | 20 |
| 7 | Chips | snack | 7 | 40 |
| 8 | Fruit tart | cake | 28 | 4 |
-- your code here: group by category, SUM(stock) adds up each group SELECT category, stock FROM products;
Run shows what your query gives. When it looks right, Submit.