SEPARATOR is an optional clause of the GROUP_CONCAT aggregate function in MySQL and MariaDB. By default, GROUP_CONCAT inserts a comma between values. Adding SEPARATOR 'str' changes that delimiter, and SEPARATOR '' removes it entirely. The output length is limited by the group_concat_max_len system variable, which defaults to 1024 bytes. Increase it at the session or global level when aggregating many or long values.
SEPARATOR is a reserved keyword in MySQL. It is not a standalone function or statement. Other databases support delimiter-based aggregation but do not use the SEPARATOR keyword. PostgreSQL and SQL Server pass a delimiter argument to STRING_AGG, and Oracle passes a delimiter to LISTAGG. For row-wise concatenation with a fixed separator, use CONCAT_WS, which takes the separator as its first argument and does not aggregate multiple rows.
GROUP_CONCAT, CONCAT_WS, STRING_AGG, LISTAGG, group_concat_max_len, ORDER BY in aggregates
MySQL 4.1 - GROUP_CONCAT added with SEPARATOR clause
Use the SEPARATOR clause, for example: GROUP_CONCAT(col SEPARATOR ' | '). The default is a comma, and SEPARATOR '' removes the delimiter.
The result is limited by group_concat_max_len, which defaults to 1024 bytes. Increase it for long strings with SET SESSION group_concat_max_len = 1000000.
PostgreSQL and SQL Server do not use the SEPARATOR keyword. They accept a delimiter argument in STRING_AGG, and Oracle uses LISTAGG with a delimiter argument.
Use CONCAT_WS for row-wise concatenation where the separator is fixed and you are not aggregating multiple rows. Use GROUP_CONCAT to aggregate many rows into one string.