How to Concatenate Strings in SQLite

SQLite doesn’t have a concat() function like many other database management systems, such as SQL Server’s concat() and MySQL’s concat().

However, that doesn’t mean you can’t concatenate two strings in SQLite.

SQLite has a concatenation operator (||) that you can use to concatenate two strings.

Example

Here’s an example to demonstrate how to concatenate two strings in SQLite.

SELECT 'Water' || 'melon';

Result:

Watermelon

You can use as many concatenation operators as you need to concatenate multiple strings.

A common usage is to add a space while concatenating two other strings.

SELECT 'Peter' || ' ' || 'Griffin';

Result:

Peter Griffin

A Database Example

Here’s an example that concatenates two columns from a database query, and inserts a space between each column’s results.

SELECT 
  CustomerId,
  FirstName || ' ' || LastName AS "Full Name"
FROM Customer 
Limit 5;

Result:

CustomerId  Full Name                
----------  -------------------------
1           Luís Gonçalves           
2           Leonie Köhler            
3           François Tremblay        
4           Bjørn Hansen             
5           František Wichterlová