CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Cleaning Data in PostgreSQL Databases

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

SELECT
  -- Concatenate issue_date and violation_time columns
  ___(___, ___, ___) AS violation_datetime
FROM
  parking_violation;
Modifier et exécuter le code