Exercise

Cleaning invalid dates

The date_first_observed column in the parking_violation dataset represents the date when the parking violation was first observed by the individual recording the violation. Unfortunately, not all date_first_observed values were recorded properly. Some records contain a '0' value for this column. A '0' value cannot be interpreted as a DATE automatically as its meaning in this context is ambiguous. The column values require cleaning to enable conversion to a proper DATE column.

In this exercise, you will convert the date_first_observed value of records with a '0' date_first_observed value into NULL values using the NULLIF() function, so that the field can be represented as a proper date.

Instructions 1/2

undefined XP
    1
    2
  • Replace '0' values in the date_first_observed using the NULLIF() function.