SQLite 3 reference · String Functions

SQLite || Concatenation Operator

Join strings with the || operator, the standard SQL way to concatenate. If either side is NULL, the result is NULL.

SQLite 3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

X || Y

Parameters

ParameterDescription
X, Y Values to join; numbers are converted to text.

Return value

The joined text, or NULL.

Examples

Build a labelTry it yourself
SELECT name || ' (' || country || ')' AS label
FROM customers
LIMIT 3;

Output

label
Ada Lovelace (UK)
Alan Turing (UK)
Grace Hopper (USA)
NULL makes the whole result NULLTry it yourself
SELECT name || ', ' || city AS with_city,
       name || ', ' || coalesce(city, 'unknown') AS safe
FROM customers
WHERE customer_id = 7;

Output

with_city | safe
NULL | Barbara Liskov, unknown

In other languages

Was this page helpful?