0
0
SQLquery~10 mins

WHERE with IS NULL and IS NOT NULL 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 rows where the column 'email' has no value (is NULL).

SQL
SELECT * FROM users WHERE email [1] NULL;
Drag options to blanks, or click blank then click option'
ALIKE
B=
CIS
DNOT
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of 'IS' to check for NULL.
Using 'LIKE' which is for pattern matching, not NULL checks.
2fill in blank
medium

Complete the code to select rows where the column 'phone' has a value (is NOT NULL).

SQL
SELECT * FROM contacts WHERE phone [1] NOT NULL;
Drag options to blanks, or click blank then click option'
AIS
B=
CLIKE
DNOT LIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or 'LIKE' instead of 'IS' for NULL checks.
Forgetting to include 'NOT' before NULL.
3fill in blank
hard

Fix the error in the code to select rows where 'address' is NULL.

SQL
SELECT * FROM customers WHERE address [1] NULL;
Drag options to blanks, or click blank then click option'
AIS
B!=
C<>
DLIKE
Attempts:
3 left
💡 Hint
Common Mistakes
Using '= NULL' which always returns false.
Using '!=' or '<>' to check for NULL.
4fill in blank
hard

Fill both blanks to select rows where 'status' is NOT NULL and 'email' is NULL.

SQL
SELECT * FROM users WHERE status [1] NOT NULL AND email [2] NULL;
Drag options to blanks, or click blank then click option'
AIS
B=
CIS NOT
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '!=' instead of 'IS' for NULL checks.
Mixing up NULL and NOT NULL syntax.
5fill in blank
hard

Fill all three blanks to select rows where 'last_login' is NOT NULL, 'email' is NOT NULL, and 'phone' is NULL.

SQL
SELECT * FROM members WHERE last_login [1] NOT NULL AND email [2] NOT NULL AND phone [3] NULL;
Drag options to blanks, or click blank then click option'
AIS
BIS NOT
C=
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '!=' instead of 'IS' or 'IS NOT'.
Confusing NULL and NOT NULL syntax.