Loading lesson path
Concept visual
Start at both ends
Add several expressions together, and add a "-" separator between them:
SELECT CONCAT_WS("-", "SQL", "Tutorial", "is", "fun!") AS ConcatenatedString;The CONCAT_WS() function adds two or more expressions together with a separator.
Also look at the CONCAT() function.
CONCAT_WS( separator, expression1, expression2, expression3,...)
Required. The separator to add between each of the expressions. If separator is NULL, this function returns NULL expression1, expression2, expression3, etc. Required. The expressions to add together. An expression with a NULL value will be skipped
From MySQL 4.0
Add three columns (and add a space between them) into one "Address" column:
SELECT CONCAT_WS(" ", Address, PostalCode, City) AS AddressCustomers;❮ MySQL Functions