Recall & Review
beginner
What does NULL represent in SQL?
NULL means a missing or unknown value. It is not the same as zero or an empty string.
Click to reveal answer
beginner
How does DISTINCT treat NULL values in SQL?
DISTINCT treats all NULLs as the same value. So, multiple NULLs count as one distinct value.
Click to reveal answer
beginner
How does GROUP BY handle NULL values?
GROUP BY groups all rows with NULL in the same column together as one group.
Click to reveal answer
intermediate
Where do NULL values appear when using ORDER BY?
In ORDER BY, NULLs usually appear last when sorting ascending, and first when sorting descending, but this can vary by database.
Click to reveal answer
intermediate
Can NULL values affect the result count in DISTINCT or GROUP BY?
Yes, since all NULLs count as one value, they reduce the number of distinct groups or rows compared to counting each NULL separately.
Click to reveal answer
In SQL, how does DISTINCT treat multiple NULL values in a column?
✗ Incorrect
DISTINCT treats all NULL values as the same, so they count as one distinct value.
When using GROUP BY on a column with NULL values, what happens to those NULLs?
✗ Incorrect
GROUP BY groups all rows with NULL in that column into a single group.
By default, where do NULL values appear when sorting with ORDER BY ascending?
✗ Incorrect
Most SQL databases place NULLs last when sorting ascending, but this can vary.
Does GROUP BY consider NULL values equal or different?
✗ Incorrect
GROUP BY treats all NULLs as equal and groups them together.
If a column has multiple NULLs, how many distinct values does DISTINCT count for those NULLs?
✗ Incorrect
DISTINCT counts all NULLs as one distinct value.
Explain how NULL values are treated in DISTINCT, GROUP BY, and ORDER BY clauses in SQL.
Think about how SQL handles unknown or missing values in these clauses.
You got /3 concepts.
Describe the impact of NULL values on the number of groups or distinct rows returned by SQL queries using DISTINCT or GROUP BY.
Consider how NULLs are treated as equal or different.
You got /2 concepts.