concat
SQLite 3.44.0+→ TEXTReturns a string which is the concatenation of the string representation of all of its non-NULL arguments; if all arguments are NULL, returns an empty string.
Signature
concat(X, ...)Parameters
| Parameter | Type | Description |
|---|---|---|
| X, ... | ANY | One or more values to concatenate; NULL values are silently skipped. |
Examples
Basic three-part concatenation
SELECT concat('Hello', ' ', 'World');'Hello World'NULL arguments are skipped, not propagated
SELECT concat('foo', NULL, 'bar');'foobar'Numeric arguments are coerced to text
SELECT concat(42, '-', 99);'42-99'All-NULL arguments return an empty string, not NULL
SELECT concat(NULL, NULL);''Practical: building a full name from table columns
SELECT concat(first_name, ' ', last_name) AS full_name FROM users WHERE id = 1;'Jane Doe'Because concat() silently skips NULLs, concat(first_name, ' ', last_name) returns 'Jane' when last_name is NULL instead of signalling the gap. This makes it impossible to distinguish a stored empty string from a genuinely absent value. If propagating NULL is the desired behaviour — so the caller knows data is incomplete — use the || operator instead.
✓ Instead: Use the || operator (first_name || ' ' || last_name) when a NULL component should make the entire result NULL and surface the missing data to the caller.
In SQLite the || operator propagates NULL — 'hello' || NULL yields NULL. concat() silently drops NULL arguments instead, making it safer when columns may be empty. For a separator between non-null parts, prefer concat_ws().
Added in SQLite 3.44.0 (2023-11-01). Unlike PostgreSQL's concat(), which also skips NULLs, SQLite's concat() returns an empty string (not NULL) when every argument is NULL. The || operator in SQLite is an alternative but propagates NULL on any null operand.