Concatenating strings


Whenever you have a bunch of string columns you might wish to combine them into a single one. You can either do that in the programming language you're using to run your SQL queries, or directly in the query.


Unlike other SQL databases, you'll have to use a function called CONCATto combine strings in MySQL. Let's have a look at a simple example:

SELECT concat('Hello', 'World')

You can also combine three strings into one:

SELECT concat('Hello', ' ', 'World')

Beside fixed strings you can also use columns as well as functions:

SELECT concat('it is ', now())


Please sign-in to post a comment