CONCAT
Overview
The CONCAT()
function is used to concatenate all inputs that consist of one or more values into one result.
The input and return types we support can be seen in the table below.
💡Special cases: Returns NULL
if there are no input rows or NULL
values.
Examples
Case 1: Basic CONCAT()
function
The below example uses the CONCAT()
function to concatenate three values = into a single result:
The final result will be as follows:
Case 2: CONCAT()
function using column
We have an example of a payment table that stores customer payment data.
The above query will display the following table:
The following query will concatenate values in the custFirstName
and custLastName
columns of the payment table:
It will display an output where spaces separate the first and last names.
Case 3: CONCAT() function with NULL
We use the CONCAT()
function in the following example to concatenate a string with a NULL
value:
The result shows that the CONCAT
function will skip the NULL
value: