Aan de slagGa gratis aan de slag

Extracting substrings from text data

In this exercise, you are going to practice how to extract substrings from text columns. The Sakila database contains the address table which stores the street address for all the rental store locations. You need a list of all the street names where the stores are located but the address column also contains the street number. You'll use several functions that you've learned about in the video to manipulate the address column and return only the street address.

Deze oefening maakt deel uit van de cursus

Functions for Manipulating Data in PostgreSQL

Cursus bekijken

Oefeninstructies

  • Extract only the street address without the street number from the address column.
  • Use functions to determine the starting and ending position parameters.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT 
  -- Select only the street name from the address table
  ___(address ___ ___(' ' ___ ___)+1 FOR ___(___))
FROM 
  address;
Code bewerken en uitvoeren