QueryCraft

Group SQL conditions with AND, OR and parentheses

AND requires both conditions to hold; OR accepts either one. Parentheses make the intended grouping explicit. Group the two product categories before applying the stock condition.

SELECT name, price FROM products WHERE (category = 'Stationery' OR category = 'Accessories') AND stock >= 10;

Common misunderstanding

AND binds more tightly than OR. A OR B AND C can return different rows from (A OR B) AND C.

Related missions

Practice opens in this page’s language. Change it in the practice options at any time.