SQL 2023 · Changing data

Insert or update (MySQL)

MySQL's version of an upsert.

INSERT INTO users (email, name) VALUES ('[email protected]', 'Ada')
ON DUPLICATE KEY UPDATE name = VALUES(name);

Official SQL 2023 documentation

More changing data commands

All changing data commands · SQL 2023 cheatsheet

Was this page helpful?