Get startedGet started for free

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.

This exercise is part of the course

Functions for Manipulating Data in PostgreSQL

View Course

Exercise instructions

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

SELECT 
  -- Select only the street name from the address table
  ___(address ___ ___(' ' ___ ___)+1 FOR ___(___))
FROM 
  address;
Edit and Run Code