Best April deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Concatenation
4. The concatenation || operator
Simple text functions
Modifying strings
Summary

## Instruction

Okay, let's begin. First, we'll need a new operator: ||. These two vertical bars are the concatenation operator, i.e., they join two or more text values (or strings, which is another name for text). If you write the following:

SELECT first_name || last_name
FROM copywriter;


The result for first_name = 'Kate' and last_name = 'Gordon' will be KateGordon, all in a single column. Quite simple, right?

Of course we want the first and last name separated with a space. Here's how you do it:

SELECT first_name || ' ' || last_name
FROM copywriter;


Note that you use apostrophes for specific constant text values (a space in our example: ' '), but you don't use apostrophes for column names (first_name, last_name). The operator || can be used as many times as you need in a single query.

## Exercise

For each item, select its name, type, and in the third column named slogan_type both values joined by a dash ('-'):

name-type

Observe that if the name or type is NULL, then the slogan_type is also NULL.

### Stuck? Here's a hint!

Use the following expression:

name || '-'  || type