SQLite 3 reference · String Functions
SQLite CONCAT_WS() Function
Join values with a separator between them, skipping NULLs. The ws stands for with separator.
SQLite 3 Since 3.44.0
Syntax
concat_ws(SEP, X, ...)
Parameters
| Parameter | Description |
|---|---|
SEP |
The separator. |
X, ... |
The values to join. |
Return value
Text, or NULL if SEP is NULL.
Examples
SELECT concat_ws(', ', name, city, country) AS address
FROM customers
WHERE customer_id IN (1, 7);
Output
address Ada Lovelace, London, UK Barbara Liskov, USA
SELECT concat_ws('-', '2026', '03', '09') AS iso_date;
Output
iso_date 2026-03-09
Version history
| Version | Change |
|---|---|
| SQLite 3.44.0 | Added |
In other languages
CONCAT_WS()· PostgreSQL
Related
CONCAT()· Join any number of values into one string. Unlike ||, NULL arguments are skipped instead of making the result NULL.GROUP_CONCAT()· Join a group's non-NULL values into one string, separated by commas or a separator you give.- SQL String Functions · tutorial