SEPARATOR

SEPARATOR is a MySQL function used in conjunction with the GROUP_CONCAT() function. It defines a delimiter to separate concatenated strings that result from a query. By default, the delimiter is a comma, but you can specify your own delimiter using the SEPARATOR clause.

Example

SELECT GROUP_CONCAT(name SEPARATOR '; ')
FROM users;

Output

John Doe; Jane Doe; Richard Roe; John Stiles

Explanation

In the provided example, the GROUP_CONCAT function is used to concatenate all the values from the name column of the users table. The SEPARATOR clause within the GROUP_CONCAT function is used to define the delimiter that separates the values, in this case, a semicolon ’;’ followed by a space. Therefore, the result is a string of all name column values separated by a semicolon and a space.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.