Get startedGet started for free

Identifying invalid parking violations

The parking_violation table has three columns populated by related time values. The from_hours_in_effect column indicates the start time when parking restrictions are enforced at the location where the violation occurred. The to_hours_in_effect column indicates the ending time for enforcement of parking restrictions. The violation_time indicates the time at which the violation was recorded. In order to ensure the validity of parking tickets, an audit is being performed to identify tickets given outside of the restricted parking hours.

In this exercise, you will use the parking restriction time range defined by from_hours_in_effect and to_hours_in_effect to identify parking tickets with an invalid violation_time.

This exercise is part of the course

Cleaning Data in PostgreSQL Databases

View Course

Hands-on interactive exercise

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

SELECT 
  -- Specify return columns
  ___, 
  ___, 
  ___, 
  ___
FROM 
  parking_violation 
WHERE 
  -- Condition on values outside of the restricted range
  violation_time ___ ___ from_hours_in_effect ___ to_hours_in_effect;
Edit and Run Code