MySQL Functions
The first two functions that we’ll look at are for working with strings.
CONCAT()
The first is the CONCAT() function. This function allows us to combine two or more strings into a single string. This is known as concatenating the strings.
To use the CONCAT() function, we need to provide it with some input. Specifically, we need to tell the function what strings to concatenate.
For instance, if we want to concatenate 'Hello' and ' World', we write
CONCAT('Hello', ' World');
To display the result of this function, we use the SELECT keyword.
Besides using the SELECT keyword to select information from tables, we can also use it to display messages.
Try running the statement below:
SELECT CONCAT('Hello', ' World');
You’ll get
Hello World
as the output.
SUBSTRING()
...