Complete the code to select all products with prices between 10 and 50.
SELECT * FROM products WHERE price [1] 10 AND 50;
The BETWEEN keyword is used to filter values within a range, inclusive of the boundary values.
Complete the code to find orders with order_date between '2023-01-01' and '2023-01-31'.
SELECT * FROM orders WHERE order_date [1] '2023-01-01' AND '2023-01-31';
The BETWEEN operator is perfect for filtering dates within a range, including both start and end dates.
Fix the error in the code to correctly filter ages between 18 and 30.
SELECT name FROM users WHERE age [1] 18 AND 30;
The correct syntax uses BETWEEN ... AND to specify a range. 'TO' is not valid in SQL.
Fill both blanks to select employees with salaries between 3000 and 7000.
SELECT * FROM employees WHERE salary [1] 3000 [2] 7000;
The BETWEEN keyword must be followed by the lower bound, then AND, then the upper bound.
Fill all three blanks to select products with quantity between 5 and 20 and price less than 100.
SELECT * FROM products WHERE quantity [1] 5 [2] 20 AND price [3] 100;
Use BETWEEN and AND for the quantity range, and '<' for price less than 100.