SQLite 3 reference · String Functions
SQLite CONCAT() Function
Join any number of values into one string. Unlike ||, NULL arguments are skipped instead of making the result NULL.
SQLite 3 Since 3.44.0
Syntax
concat(X, ...)
Parameters
| Parameter | Description |
|---|---|
X, ... |
One or more values to join. |
Return value
Text (never NULL).
Examples
SELECT concat('Order #', order_id, ' - ', status) AS label
FROM orders
LIMIT 3;
Output
label Order #1 - delivered Order #2 - delivered Order #3 - delivered
SELECT concat(name, ' / ', city) AS with_concat,
name || ' / ' || city AS with_pipes
FROM customers
WHERE customer_id = 7;
Output
with_concat | with_pipes Barbara Liskov / | NULL
Version history
| Version | Change |
|---|---|
| SQLite 3.44.0 | Added |
In other languages
CONCAT()· PostgreSQL
Related
||· Join strings with the || operator, the standard SQL way to concatenate. If either side is NULL, the result is NULL.CONCAT_WS()· Join values with a separator between them, skipping NULLs. The ws stands for with separator.FORMAT()· Build a string from a template with printf-style placeholders such as %s, %d, %.2f and %,d. printf() is the old name.- SQL String Functions · tutorial