- Notifications
You must be signed in to change notification settings - Fork689
IGNORE
Mathias Wulff edited this pageDec 15, 2025 ·1 revision
TheIGNORE keyword is used to skip errors that occur during data manipulation operations.
When usingINSERT 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 STRINGPRIMARY KEY, populationINT);INSERT INTO citiesVALUES ('Paris',2200000);-- This would normally throw an error due to duplicate key 'Paris'-- With IGNORE, it simply skips this row and continuesINSERT IGNORE INTO citiesVALUES ('Paris',2300000), ('London',8900000);-- Result: 'Paris' keeps original value, 'London' is added
See also:INSERT
© 2014-2026,Andrey Gershun &Mathias Rangel Wulff
Please help improve the documentation by opening a PR on thewiki repo