IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Functions for Manipulating Data in PostgreSQL

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- Concatenate the first_name and last_name and email 
SELECT ___ ___ ' ' ___ ___ ___ ' <' ___ ___ ___ '>' AS full_email 
FROM customer
Modifica ed esegui il codice