SQL And
AND asks for several conditions to be true at the same time. It is useful when a report needs a narrow group, such as products that are both affordable and available for sale.
Understand the idea
Each comparison describes one requirement. This query excludes zero-stock products even if their price fits. Keep the units visible: stock is a count, while price_cents is a monetary amount in cents. When a query becomes hard to read, put each condition on its own line and give the underlying business rule a short explanation.
Where to try it
Run this example in the SQL playground. The lesson link loads the shop tables and sample rows before this query. Select Run when you are ready. Every run starts fresh, so your changes do not affect the website or a previous run.
SQLite sample data · MySQL / MariaDB sample data · See the sample tables
A worked example
SELECT name, stock, price_cents
FROM products
WHERE stock > 0
AND price_cents <= 900
ORDER BY product_id;
Read the result
Pocket notebook and Pencil set remain. Canvas bag meets the price rule but fails the stock rule, so it is not included. Both requirements must pass.
Try one change
Add AND category = 'Stationery'. Then change it to Home and explain why the result becomes empty.