SQL IS NULL

Starting here? This lesson is part of a full-length tutorial in using SQL for Data Analysis. Check out the beginning.

The IS NULL operator

IS NULL is a logical operatorin SQL that allows you to exclude rows with missing data from your results.

Some tables contain null values—cells with no data in them at all. This can be confusing for heavy Excel users, because the difference between a cell having no data and a cell containing a space isn't meaningful in Excel. In SQL, the implications can be pretty serious. This is covered in greater detail in the intermediate tutorial, but for now, here's what you need to know:

You can select rows that contain no data in a given column by using IS NULL. Let's try it out using a dataset from the Billboard Music Charts.

SELECT *
  FROM tutorial.billboard_top_100_year_end
 WHERE artist IS NULL

WHERE artist = NULL will not work—you can't perform arithmetic on null values.

Sharpen your SQL skills

Write a query that shows all of the rows for which song_name is null.

Next Lesson

SQL AND

Looks like you've got a thing for cutting-edge data news.

Get the latest.

Get started