0
0
MySQLquery~10 mins

IS NULL and IS NOT NULL in MySQL - 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 column 'email' has no value (is NULL).

MySQL
SELECT * FROM users WHERE email [1];
Drag options to blanks, or click blank then click option'
A= NULL
BIS NULL
CIS NOT NULL
D!= NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using '= NULL' instead of 'IS NULL'
Using '!=' or '<>' to check for NULL
2fill in blank
medium

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

MySQL
SELECT * FROM contacts WHERE phone [1];
Drag options to blanks, or click blank then click option'
AIS NOT NULL
B!= NULL
CIS NULL
D= NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using '= NULL' or '!= NULL' which do not work for NULL checks
Using 'IS NULL' instead of 'IS NOT NULL'
3fill in blank
hard

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

MySQL
SELECT * FROM customers WHERE address [1];
Drag options to blanks, or click blank then click option'
A!= NULL
BIS NOT NULL
C= NULL
DIS NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '!=' operators with NULL
Confusing IS NULL and IS NOT NULL
4fill in blank
hard

Fill both blanks to select rows where 'birthdate' is NOT NULL and 'nickname' IS NULL.

MySQL
SELECT * FROM profiles WHERE birthdate [1] AND nickname [2];
Drag options to blanks, or click blank then click option'
AIS NOT NULL
BIS NULL
C= NULL
D!= NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using '= NULL' or '!= NULL' instead of IS NULL or IS NOT NULL
Mixing up IS NULL and IS NOT NULL
5fill in blank
hard

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

MySQL
SELECT * FROM users WHERE email [1] AND phone [2] AND status [3];
Drag options to blanks, or click blank then click option'
AIS NULL
BIS NOT NULL
C!= NULL
D= NULL
Attempts:
3 left
💡 Hint
Common Mistakes
Using '= NULL' or '!= NULL' operators
Confusing which columns should be NULL or NOT NULL