LoslegenKostenlos loslegen

Splitting house numbers with a delimiter

In the previous exercise, you used STRPOS(), LENGTH(), and SUBSTRING() to separate the actual house number for Queens addresses from the value representing a cross street. In the video exercise, you learned how strings can be split into parts based on a delimiter string value.

In this exercise, you will extract the house number for Queens addresses using the SPLIT_PART() function.

Diese Übung ist Teil des Kurses

Cleaning Data in PostgreSQL Databases

Kurs anzeigen

Anleitung zur Übung

  • Write a query that returns the part of the house_number value after the dash character ('-') (if a dash character is present in the column value) as the column new_house_number.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

SELECT
  -- Split house_number using '-' as the delimiter
  ___(___, ___, ___) AS ___
FROM
  parking_violation
WHERE
  violation_county = 'Q';
Code bearbeiten und ausführen