Creating a TIMESTAMP with concatenation
In a previous exercise, the violation_time
column in the parking_violation
table was used to check that the recorded violation_time
is within the violation location's restricted times. This presented a challenge in cases where restricted parking took place overnight because, for these records, the from_hours_in_effect
time is later than the to_hours_in_effect
time. This issue could be eliminated by including a date in addition to the time of a violation.
In this exercise, you will begin the process of simplifying the identification of overnight violations through the creation of the violation_datetime
column populated with TIMESTAMP
values. This will be accomplished by concatenating issue_date
and violation_time
and converting the resulting strings to TIMESTAMP
values.
This exercise is part of the course
Cleaning Data in PostgreSQL Databases
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
SELECT
-- Concatenate issue_date and violation_time columns
___(___, ___, ___) AS violation_datetime
FROM
parking_violation;