-
Notifications
You must be signed in to change notification settings - Fork 689
IGNORE
Mathias Wulff edited this page Dec 15, 2025
·
1 revision
The IGNORE keyword is used to skip errors that occur during data manipulation operations.
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:
CREATE TABLE cities (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 continues
INSERT IGNORE INTO cities VALUES ('Paris', 2300000), ('London', 8900000);
-- Result: 'Paris' keeps original value, 'London' is addedSee also: INSERT
© 2014-2026, Andrey Gershun & Mathias Rangel Wulff
Please help improve the documentation by opening a PR on the wiki repo