Session Ready
Exercise

Identifying out-of-range vehicle model years

Type constraints are useful for restricting the type of data that can be stored in a table column. However, there are limitations to how thoroughly these constraints can prevent invalid data from entering the column. Range constraints are useful when the goal is to identify column values that are included in a range of values or excluded from a range of values. Using type constraints when defining a table followed by checking column values with range constraints are a powerful approach to ensuring the integrity of data.

In this exercise, you will use a BETWEEN clause to build a range constraint to identify invalid vehicle model years in the parking_violation table. Valid vehicle model years for this dataset are considered to be between 1970 and 2021.

Instructions
100 XP
  • Write a query that returns the summons_number, plate_id, and vehicle_year for records in the parking_violation table containing a vehicle_year outside of the range 1970-2021.