0
0
SQLquery~10 mins

WHERE with NOT 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 status is NOT 'active'.

SQL
SELECT * FROM users WHERE status [1] 'active';
Drag options to blanks, or click blank then click option'
A=
B!=
CNOT
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '!=' selects only 'active' rows.
Using 'NOT' alone without a comparison causes syntax error.
2fill in blank
medium

Complete the code to select all products where the category is NOT 'electronics'.

SQL
SELECT * FROM products WHERE NOT category [1] 'electronics';
Drag options to blanks, or click blank then click option'
A=
BLIKE
C!=
DIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' after NOT causes double negation and confusion.
Using 'IN' without parentheses causes syntax error.
3fill in blank
hard

Fix the error in the code to select all employees who are NOT in department 5.

SQL
SELECT * FROM employees WHERE NOT department_id [1] 5;
Drag options to blanks, or click blank then click option'
ALIKE
B!=
C=
DIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' after NOT causes syntax or logic errors.
Using 'IN' without NOT or parentheses causes errors.
4fill in blank
hard

Fill both blanks to select all orders where the status is NOT 'shipped' and the quantity is NOT 10.

SQL
SELECT * FROM orders WHERE NOT status [1] 'shipped' AND quantity [2] 10;
Drag options to blanks, or click blank then click option'
A=
B!=
C<>
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' after NOT causes double negation.
Using '=' for quantity would select only quantity 10.
5fill in blank
hard

Fill all three blanks to select all customers where the city is NOT 'Paris', the country is NOT 'France', and the age is NOT 30.

SQL
SELECT * FROM customers WHERE NOT city [1] 'Paris' AND NOT country [2] 'France' AND age [3] 30;
Drag options to blanks, or click blank then click option'
A=
B!=
C<>
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' after NOT causes double negation.
Using '=' for age selects only age 30.