Complete the code to select all rows where the city is either 'New York' or 'Los Angeles'.
SELECT * FROM customers WHERE city [1] 'New York' OR city = 'Los Angeles';
The = operator checks if the city matches 'New York'. Combined with OR, it selects rows where city is 'New York' or 'Los Angeles'.
Complete the code to select products where the category is 'Books' or the price is less than 20.
SELECT * FROM products WHERE category = 'Books' OR price [1] 20;
The condition price < 20 selects products priced below 20. Combined with OR, it includes all books or any product cheaper than 20.
Fix the error in the query to select employees who work in 'HR' or have a salary greater than 50000.
SELECT * FROM employees WHERE department = 'HR' [1] salary > 50000;
The OR operator ensures the query selects employees in 'HR' or those with salary over 50000. Using AND would require both conditions to be true, which is not the goal.
Fill both blanks to select orders where the status is 'Pending' or the total is greater than 100.
SELECT * FROM orders WHERE status [1] 'Pending' [2] total > 100;
The first blank needs = to check if status equals 'Pending'. The second blank needs OR to select orders that meet either condition.
Fill all three blanks to select customers who live in 'Chicago' or 'Houston' and have made more than 5 orders.
SELECT * FROM customers WHERE (city = [1] [2] city = [3]) AND orders_count > 5;
The query checks if city is 'Chicago' or 'Houston' using OR inside parentheses, then filters customers with more than 5 orders using AND.