Detecting out of range values
Sometimes you can find out of range values in your data. If you don't detect them before analyzing, they can disrupt your results.
The logical operator BETWEEN
, and the comparison operators >
and <
, can help you to detect the rows with out of range values.
The num_ratings
column of the series
table stores the number of ratings each series has received. The total amount of people surveyed is 5000. However, this column has some out of range values, i.e., there are values greater than 5000 or smaller than 0.
Try to find them!
This exercise is part of the course
Cleaning Data in SQL Server Databases
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT * FROM series
-- Detect the out of range values
WHERE ___ ___ ___ 0 AND 5000