Skip to content
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:

    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 added

See also: INSERT

Clone this wiki locally