Null values
Part of the Fundamentals section of Coddy's SQL journey — lesson 12 of 72.
In the real world, we might have fields with no values. A field with no value is called null.
We can manipulate our query using IS NULL or IS NOT NULL to fetch relevant data
For example the following query will return all of the records where col1 has no value:
SELECT *
FROM table1
WHERE col1 IS NULLChallenge
EasyAvailable tables and columns:
<strong>people</strong>:<strong>name</strong>
Fetch all of the unique names without missing values.
Cheat sheet
Use IS NULL and IS NOT NULL to filter records based on missing values:
SELECT *
FROM table1
WHERE col1 IS NULLSELECT *
FROM table1
WHERE col1 IS NOT NULLTry it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns