Aan de slagGa gratis aan de slag

Concatenating strings

In this exercise and the ones that follow, we are going to derive new fields from columns within the customer and film tables of the DVD rental database.

We'll start with the customer table and create a query to return the customers name and email address formatted such that we could use it as a "To" field in an email script or program. This format will look like the following:

Brian Piccolo <[email protected]>

In the first step of the exercise, use the || operator to do the string concatenation and in the second step, use the CONCAT() functions.

Deze oefening maakt deel uit van de cursus

Functions for Manipulating Data in PostgreSQL

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

-- Concatenate the first_name and last_name and email 
SELECT ___ ___ ' ' ___ ___ ___ ' <' ___ ___ ___ '>' AS full_email 
FROM customer
Code bewerken en uitvoeren