Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select rows where the column 'age' is NULL.
SQL
SELECT * FROM users WHERE age [1] NULL; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' to compare with NULL, which always returns false.
✗ Incorrect
In SQL, NULL is not a value, so you must use IS or IS NOT to check for NULL.
2fill in blank
mediumComplete the code to select rows where 'salary' is NOT NULL.
SQL
SELECT * FROM employees WHERE salary [1] NULL; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' or '<>' to check for NOT NULL, which does not work correctly.
✗ Incorrect
To check that a column is not NULL, use IS NOT NULL in SQL.
3fill in blank
hardFix the error in the query to find rows where 'score' is NULL.
SQL
SELECT * FROM results WHERE score [1] NULL; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or 'LIKE' to compare with NULL.
✗ Incorrect
Use IS NULL to check for NULL values, not '=' or other operators.
4fill in blank
hardFill both blanks to select rows where 'date' is NULL or 'status' is NOT NULL.
SQL
SELECT * FROM orders WHERE date [1] NULL OR status [2] NULL;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '!=' to check for NULL or NOT NULL.
✗ Incorrect
Use IS NULL to check for NULL and IS NOT NULL to check for NOT NULL.
5fill in blank
hardFill all three blanks to select rows where 'price' is NULL, 'quantity' is NOT NULL, and 'discount' equals 0.
SQL
SELECT * FROM sales WHERE price [1] NULL AND quantity [2] NULL AND discount [3] 0;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' to check for NULL or '!=' to check for NOT NULL.
✗ Incorrect
Use IS NULL for NULL, IS NOT NULL for NOT NULL, and '=' for exact value comparison.