Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQlite concat select statement

Tags:

select

sqlite

I would like to know if it is possible to concat and add a space in SQlite. This is what I mean:

SELECT NAME || SURNAME AS USER_NAME FROM USERS

But then add something to the query to let the result be displayed as:

Name Surname

and not

NameSurname

Is something like this possible in SQlite?

like image 329
Lunchbox Avatar asked Jul 15 '13 14:07

Lunchbox


People also ask

Does SQLite have concat?

The SQL standard provides the CONCAT() function to concatenate two strings into a single string. SQLite, however, does not support the CONCAT() function. Instead, it uses the concatenate operator ( || ) to join two strings into one.

What does || mean in SQLite?

Description. The SQLite || operator allows you to concatenate 2 or more strings together.

How do you concatenate in MySQL?

CONCAT() function in MySQL is used to concatenating the given arguments. It may have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string.


1 Answers

Concat also the space:

SELECT NAME || ' ' || SURNAME AS USER_NAME FROM USERS
like image 89
Tobia Zambon Avatar answered Sep 18 '22 15:09

Tobia Zambon