SQL NULL Values

Missing values and IS NULL.

✍️ 3 exercises + code challenge in this lesson

NULL means a field has no value. It is not zero and not an empty string.

  • You cannot test for NULL with =. Use IS NULL and IS NOT NULL.
  • COALESCE(column, 'default') (or IFNULL in MySQL/SQLite, ISNULL in SQL Server) replaces NULL with another value.

Key Takeaways: SQL NULL Values

Mastering SQL NULL Values helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

SQL NULL Values Code Example

SQL
SELECT CustomerName, Email FROM Customers
WHERE Email IS NULL;

SELECT CustomerName, COALESCE(Email, 'no email on file') AS Email
FROM Customers;
Free sign-in required · Google login available

SQL NULL Values Practice Exercises

Check what you learned in “SQL NULL Values”.

/ 3 solved
Fill in the blank

Find customers without an email.

SELECT * FROM Customers WHERE Email ;
✓ Correct! Not quite. Try again.
Multiple choice

Why does "WHERE Email = NULL" not work?

✓ Correct! Not quite. Try again.
Code challenge

Select CustomerName of customers that DO have an email.

Write the code in the live editor. Your answer is checked automatically.

Free sign-in required · Google login available

to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services