The MySQL AND operator combines two or more boolean conditions in a WHERE, ON, or HAVING clause. A row appears in the output only when every condition joined by AND evaluates to true.
Chain multiple filters using AND to narrow down large result sets accurately:
SELECT columns
FROM table_name
WHERE condition1 AND condition2 AND condition3;
The query below finds active electronics in demo_products that are in stock and cost less than 100 dollars.
SELECT id, product_name, price, stock_qty
FROM demo_products
WHERE category = 'electronics'
AND is_active = 1
AND stock_qty > 0
AND price < 100.00
ORDER BY price ASC;
| id | product_name | price | stock_qty |
|---|---|---|---|
| 33 | USB-C Fast Charger | 24.99 | 48 |
| 41 | Bluetooth Tracker | 39.00 | 19 |
AND Before OR): MySQL evaluates AND before OR. Always wrap OR branches in parentheses: WHERE is_active = 1 AND (role = 'admin' OR role = 'editor'). Without parentheses, inactive editors slip through.WHERE tenant_id = 5 AND status = 'open' AND created_at >= '2026-08-01', list equality columns (tenant_id, status) before range columns (created_at) in your index definition.AND is FALSE, the result is FALSE; if one side is TRUE and the other is NULL, the result is UNKNOWN and the row is excluded.AND conditions I can chain?There is no practical limit in everyday queries, though keeping conditions readable and index-backed helps performance.
AND short-circuit in MySQL?MySQL optimizes evaluation order dynamically using indexes and column statistics rather than strictly left-to-right.
WHERE a = 1 AND b = NULL is executed?b = NULL evaluates to UNKNOWN, so TRUE AND UNKNOWN produces UNKNOWN and returns zero rows; use b IS NULL instead.
Sign in to track your learning journey, earn industry-recognized certificates, and join our elite developer community.
Quick Access With
Experiment with the code from this lesson in our interactive playground.