Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
mysql
concat
communitycreator

What is CONCAT() in SQL?

harris910

The CONCAT() function is used to concatenate n number of arguments.

The illustration below shows how the CONCAT() function works.

String 1 (Argument 1)
1 of 6

Syntax

CONCAT(arg1, arg2, .... argn)

Parameter

The CONCAT() function takes in n number of arguments as a parameter.

Return value

The CONCAT() function returns the single string concatenating the arguments sent as parameter.

Example

The example below shows how we can use the CONCAT() function to concatenate the first and last names of the students.

Students

Student ID

Student First Name

Student Last Name

1

David

Lew

2

Luiss

Kevin

3

Harvey

Dave

4

Lucy

Dan

5

Andrew

Wade

select *, CONCAT(studentFirstName,' ',studentLastName) as studentFullName
from Students

Another example

This example explains some other implementations of the CONCAT() function.

-- concat the numbers
SELECT CONCAT(9,10,100);

-- concat the number and string
SELECT CONCAT('Educative', 10);

RELATED TAGS

sql
mysql
concat
communitycreator
RELATED COURSES

View all Courses

Keep Exploring