Home > Software engineering >  How do I use CONCAT on SQL lite environment?
How do I use CONCAT on SQL lite environment?

Time:12-15

How do you use CONCAT function on DEBEAVER environment. Thanks in advance

CONCAT(CustomerID, " ", CustomerName)

CodePudding user response:

SELECT CONCAT(City , " ", Country) FROM customers c this returns an error also says : SQL Error [1]: [SQLITE_ERROR] SQL error or missing database (no such function: CONCAT)

CodePudding user response:

In SQLite, The || operator is "concatenate" - it joins together the two strings of its operands.

create table customer (
   customerId   int, 
   customerName text);

insert into customer
values
(101, 'Adam'),
(102, 'Eve');


select customerId || ' ' || customerName as customer_Id_and_Name
  from customer;

Result:

customer_Id_and_Name|
-------------------- 
101 Adam            |
102 Eve             |

By the way, it's not limited in DBeaver. You can run the query in any SQLite query tools:

  • Related