INSERT IGNORE
INSERT IGNORE is a SQL statement in the DML Statements category. MySQL: insert that silently ignores errors (duplicate key, constraint violations) instead of failing. The syntax is INSERT IGNORE INTO table (columns) VALUES (values);. It returns rows inserted (or 0 if skipped). A typical example: INSERT IGNORE INTO employees (id, name, email) VALUES (1, 'Bob', 'bob@test.com'); -- If id=1 already exists, silently skip (no error, no update) -- Affected rows = 0 for skipped -- Compare: -- INSERT ... ON DUPLICATE KEY UPDATE: updates on conflict -- REPLACE INTO: deletes and re-inserts on conflict -- INSERT IGNORE: silently skips on conflict -- USE WITH CAUTION: silently hides all errors, not just duplicates A close relative is INSERT INTO, which inserts new rows into a table. A close relative is UPDATE, which modifies existing rows in a table. Always use WHERE to avoid updating all rows. A close relative is DELETE, which removes rows from a table. Always use WHERE to avoid deleting all rows.