Skip to content
Advertisement

MySQL concatenation operator

I don’t know concatenation operator for MySQL.

I have tried this code for concatenation:

SELECT vend_name || ' (' || vend_country || ')'
FROM Vendors
ORDER BY vend_name;

But it didn’t work. Which operator should I use to concatenate strings?

Advertisement

Answer

You were using ORACLE type of concatenation. MySQL’s Should be

 SELECT CONCAT(vend_name, '(', vend_country, ')')

Call the CONCAT() function and separate your values with commas.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement