You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mathias Wulff edited this page Dec 15, 2025
·
1 revision
Keyword IGNORE
The IGNORE keyword is used to skip errors that occur during data manipulation operations.
INSERT IGNORE
When using INSERT IGNORE, rows that cause unique constraint violations (like duplicate primary keys) are skipped instead of throwing an error.
Syntax:
INSERT IGNORE INTO table ...
Example:
CREATETABLEcities (name STRING PRIMARY KEY, population INT);
INSERT INTO cities VALUES ('Paris', 2200000);
-- This would normally throw an error due to duplicate key 'Paris'-- With IGNORE, it simply skips this row and continuesINSERT IGNORE INTO cities VALUES ('Paris', 2300000), ('London', 8900000);
-- Result: 'Paris' keeps original value, 'London' is added