How to Concatenate Strings in MySQL

Last updated July 25, 2026 · By the SaturnSQL team

Use CONCAT to join strings and CONCAT_WS to join with a separator while skipping NULLs. The || operator is logical OR in MySQL by default, not concatenation, unless sql_mode includes PIPES_AS_CONCAT.

SELECT CONCAT(first_name, ' ', last_name) AS full_name
FROM customers;

CONCAT_WS skips NULLs

SELECT CONCAT_WS(', ', street, city, postal_code) AS address
FROM customers;

CONCAT returns NULL if any argument is NULL. Wrap optional parts in COALESCE(col, '') or switch to CONCAT_WS, which ignores NULL arguments entirely.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related MySQL guides

© 2026 Panda Capital Oy Ab. All rights reserved.