BaşlayınÜcretsiz Başlayın

Split strings on a delimiter

The street suffix is the part of the street name that gives the type of street, such as Avenue, Road, or Street. In the Evanston 311 data, sometimes the street suffix is the full word, while other times it is the abbreviation.

Extract just the first word of each street value to find the most common streets regardless of the suffix.

To do this, use

split_part(string_to_split, delimiter, part_number)

Bu egzersiz

Exploratory Data Analysis in SQL

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Use split_part() to select the first word in street; alias the result as street_name.
  • Also select the count of each value of street_name.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

-- Select the first word of the street value
SELECT ___ AS street_name, 
       count(*)
  FROM evanston311
 GROUP BY ___
 ORDER BY count DESC
 LIMIT 20;
Kodu Düzenle ve Çalıştır