0
0
SQLquery~10 mins

WHERE with comparison operators 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 employees with salary greater than 50000.

SQL
SELECT * FROM employees WHERE salary [1] 50000;
Drag options to blanks, or click blank then click option'
A>
B<
C=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '>' will only select salaries exactly 50000.
Using '<' will select salaries less than 50000.
2fill in blank
medium

Complete the code to find products with quantity less than or equal to 10.

SQL
SELECT product_name FROM inventory WHERE quantity [1] 10;
Drag options to blanks, or click blank then click option'
A>
B=
C>=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' will exclude rows where quantity equals 10.
Using '=' will only select rows where quantity is exactly 10.
3fill in blank
hard

Fix the error in the code to select customers with age not equal to 30.

SQL
SELECT * FROM customers WHERE age [1] 30;
Drag options to blanks, or click blank then click option'
A!=
B=
C<>
D==
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' may cause errors in some SQL databases.
Using '==' is invalid in SQL.
4fill in blank
hard

Fill both blanks to select orders with total_price greater than 100 and less than 500.

SQL
SELECT order_id FROM orders WHERE total_price [1] 100 AND total_price [2] 500;
Drag options to blanks, or click blank then click option'
A>
B<
C>=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>=' or '<=' changes the range to include 100 or 500.
Mixing up the operators reverses the logic.
5fill in blank
hard

Fill all three blanks to select employees with age greater than 25, salary less than or equal to 70000, and department not equal to 'HR'.

SQL
SELECT * FROM employees WHERE age [1] 25 AND salary [2] 70000 AND department [3] 'HR';
Drag options to blanks, or click blank then click option'
A>
B<=
C<>
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '<>' for 'not equal to' condition.
Using '<' instead of '<=' for salary condition.