Which products are available?
Return the name of each product with stock greater than zero, ordered by id.
Your queryQuery investigation
Explore the fictional database
products id | name | stock 1 | Notebook | 5 2 | Lamp | 2 3 | Bag | 0 orders id | customer | total 1 | Asha | 20 2 | Ben | 35 3 | Asha | 80
Read-only SELECT queries. Columns and row order should match the task.
Investigation result5 min · no timer
Show solution and explanation
Return the name of each product with stock greater than zero, ordered by id. Use WHERE to filter, ORDER BY to sort, and GROUP BY with SUM to aggregate.
SELECT name FROM products WHERE stock > 0 ORDER BY id;