1. Learn
  2. /
  3. Courses
  4. /
  5. Cleaning Data in PostgreSQL Databases

Exercise

Using a fill-in value

The sedan body type is the most frequently occurring vehicle_body_type in the sample parking violations. For this reason, you propose changing all NULL-valued vehicle_body_type records in the parking_violations table to SDN. Discussions with your team result in a decision to use a value other than SDN as a fill-in value. The body type can be determined by looking up the vehicle using its license plate number. A license plate number is present in most parking_violation records. Rather than using the most frequent value to replace NULL vehicle_body_type values, a placeholder value of Unknown will be used. The actual body type will be updated as license plate lookup data is gathered.

In this exercise, you will replace NULL vehicle_body_type values with the string Unknown.

Instructions

100 XP
  • Use COALESCE() to replace any vehicle_body_type that is NULL with the string value Unknown in the parking_violation table.