Home > Enterprise >  How can I use CONCATENATE in SQL
How can I use CONCATENATE in SQL

Time:12-24

I want to know to use CONCATENATE function to combine multiple data

CodePudding user response:

In MySQL you can use it as below:

SELECT CONCAT('This ', ' is ', 'concatenated ', 'String') AS ConcatenatedString
FROM DUAL;

in Oracle:

If you want more 'fancy' variation, strings can be concatenated as below:

SELECT 'This ' || ' is ' || 'concatenated ' || 'String' AS ConcatenatedString
FROM DUAL;

The second variation is the one I personally prefer.

CodePudding user response:

you can concat two column or specifix text also.

SELECT 
    customer_id,(column)
    first_name,
    last_name,
    CONCAT(first_name, ' ', last_name) full_name
FROM 
    sales.customers
or

SELECT CONCAT('john', ' foe',) as name;

  •  Tags:  
  • sql
  • Related