How to concatenate strings and numbers in MySQL?

In MySQL, you can use the CONCAT function to concatenate strings and numbers together.

Here is an example:

SELECT CONCAT('字符串', 数字) AS 结果;

In the example above, replace the string ‘string’ and number with the actual string and number you want to concatenate. Return the result as an alias for ‘result’.

For example, if you want to concatenate the string ‘Hello’ with the number 123, you can execute the following query:

SELECT CONCAT('Hello', 123) AS 结果;

This will return a result set that includes a column named ‘result’ with a value of ‘Hello123’.

bannerAds