0
0
SQLquery~10 mins

WHERE with OR operator in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all rows where the city is either 'New York' or 'Los Angeles'.

SQL
SELECT * FROM customers WHERE city [1] 'New York' OR city = 'Los Angeles';
Drag options to blanks, or click blank then click option'
A!=
B=
C<>
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' or '<>' which check for inequality.
Using 'LIKE' without wildcards.
2fill in blank
medium

Complete the code to select products where the category is 'Books' or the price is less than 20.

SQL
SELECT * FROM products WHERE category = 'Books' OR price [1] 20;
Drag options to blanks, or click blank then click option'
A>
B=
C<
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which selects prices greater than 20.
Using '=' which selects prices exactly 20.
3fill in blank
hard

Fix the error in the query to select employees who work in 'HR' or have a salary greater than 50000.

SQL
SELECT * FROM employees WHERE department = 'HR' [1] salary > 50000;
Drag options to blanks, or click blank then click option'
AOR
BAND
CNOT
DXOR
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'AND' which restricts results to both conditions.
Using 'NOT' or 'XOR' which are not appropriate here.
4fill in blank
hard

Fill both blanks to select orders where the status is 'Pending' or the total is greater than 100.

SQL
SELECT * FROM orders WHERE status [1] 'Pending' [2] total > 100;
Drag options to blanks, or click blank then click option'
A=
B<
COR
DAND
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'AND' instead of 'OR' which restricts results.
Using '<' in the first blank which is incorrect for string comparison.
5fill in blank
hard

Fill all three blanks to select customers who live in 'Chicago' or 'Houston' and have made more than 5 orders.

SQL
SELECT * FROM customers WHERE (city = [1] [2] city = [3]) AND orders_count > 5;
Drag options to blanks, or click blank then click option'
A'Chicago'
B'Houston'
COR
DAND
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'AND' instead of 'OR' between city conditions.
Not using quotes around city names.