Beginner#03 · COUNT, WHERE

Running low

The warehouse wants to reorder anything with fewer than 10 units left. Return a single number: how many products have stock_qty below 10?

Write your query in the lab. It runs in your browser and tells you exactly what's wrong if it doesn't match.

Solve it in the lab

Hints

Hint 1

COUNT(*) counts the rows that survive the WHERE filter.

Hint 2

Use stock_qty < 10.

Expected output

Your result should match this, in any order (1 row).

low_stock
10

Model answer

Show the solution
SELECT COUNT(*) AS low_stock
FROM products
WHERE stock_qty < 10;

Other queries that return the same rows are correct too. The lab checks your result, not your exact wording.

Next challenge: March orders →