Get Started

Removing missing values

There are a number of different techniques you can use to fix missing data in T-SQL and in this exercise, you will focus on returning rows with non-missing values. For example, to return all rows with non-missing SHAPE values, you can use:

SELECT *  
FROM Incidents
WHERE Shape IS NOT NULL

This is a part of the course

“Intermediate SQL Server”

View Course

Exercise instructions

Write a T-SQL query which returns only the IncidentDateTime and IncidentState columns where IncidentState is not missing.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Return the specified columns
___
FROM Incidents
-- Exclude all the missing values from IncidentState  
WHERE ___

This exercise is part of the course

Intermediate SQL Server

IntermediateSkill Level
4.3+
32 reviews

In this course, you will use T-SQL, the flavor of SQL used in Microsoft's SQL Server for data analysis.

One of the first steps in data analysis is examining data through aggregations. This chapter explores how to create aggregations in SQL Server, a common first step in data exploration. You will also clean missing data and categorize data into bins with CASE statements.

Exercise 1: Data analysis with aggregationsExercise 2: Creating aggregationsExercise 3: Creating grouped aggregationsExercise 4: Dealing with missing dataExercise 5: Removing missing values
Exercise 6: Imputing missing values (I)Exercise 7: Imputing missing values (II)Exercise 8: Binning data with CASEExercise 9: Using CASE statementsExercise 10: Creating several groups with CASE

What is DataCamp?

Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.

Start Learning for Free