ItecSoftware Logo

MySQL Insert If Not Exists

By Peter Gilg on
mysql insert if not exists

INSERT IGNORE is the syntax for something equivalent for MySQL INSERT IF NOT EXISTS. There is really no direct command matching the SQL Server version as outlined in this articles title, at least not in the current release of MySql.

The statement INSERT IGNORE and to some extent REPLACE INTO, do essentially the same thing, inserting a record if that given record does not exists.

MySQL insert if not exists

Let’s consider the following samples, where we want a record inserted if it’s ...

read more

Listed in Linux, MySQL, Web Development

Tags: insert if not exists, lamp, MySQL, replace into