Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Insert Or Ignore In SQLite

Code

CREATE TABLE example_table(example_item TEXT UNIQUE);

Then do this:

Code

INSERT OR IGNORE 
INTO example_table(example_item) 
VALUES("alfa bravo");

Note that with this approach an AUTOINCREMENT counter increases even if a row isn't inserted. If that bugs you, you can either not use AUTOINCREMENT (e.g. use the generic ROWID) or use a different approach.

References