Get startedGet started for free

Changing the case of string data

Now you are going to use the film and category tables to create a new field called film_category by concatenating the category name with the film's title. You will also format the result using functions you learned about in the video to transform the case of the fields you are selecting in the query; for example, the INITCAP() function which converts a string to title case.

This exercise is part of the course

Functions for Manipulating Data in PostgreSQL

View Course

Exercise instructions

  • Convert the film category name to uppercase.
  • Convert the first letter of each word in the film's title to upper case.
  • Concatenate the converted category name and film title separated by a colon.
  • Convert the description column to lowercase.

Hands-on interactive exercise

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

SELECT 
  -- Concatenate the category name to coverted to uppercase
  -- to the film title converted to title case
  ___(___)  || ': ' || ___(___) AS film_category, 
  -- Convert the description column to lowercase
  ___(___) AS description
FROM 
  film AS f 
  INNER JOIN film_category AS fc 
  	ON f.film_id = fc.film_id 
  INNER JOIN category AS c 
  	ON fc.category_id = c.category_id;
Edit and Run Code