mySql  concat function

the mysql concat function is used to concatenate two or more string and returns concatenating string.

if the arguments are numeric, they will be converted to strings before concatenating.if any of argument in the argument list is null, the concat function will return null.

mysql concat() function syntax

         select    concat(column_name , column_name)    from   table_name;

this demo database table in below mysql concat function example

below is a selection from the "users" table:

useridfirstnamelastnamesalarybonus
1sandeepkumar10,0001000
2ankitkumar20,0002000
3ramnehra30,0003000
4vikashnehra12,0002000

mysql concat function example

               
    select    concat(firstname,',',lastname)   as  name    from    users;

output :

name
sandeep,kumar
ankit,kumar
ram,nehra
vikash,nehra