Sqlite table constraint - unique on multiple columns
Posted
by Rich
on Stack Overflow
See other posts from Stack Overflow
or by Rich
Published on 2010-04-23T20:45:37Z
Indexed on
2010/04/23
20:53 UTC
Read the original article
Hit count: 408
I can find syntax "charts" on this on the sqlite website, but no examples and my code is crashing. I have other tables with unique constraints on a single column, but I want to add a constraint to the table on two columns. This is what I have that is causing a SQLiteException with the message "syntax error".
CREATE TABLE name (column defs) UNIQUE (col_name1, col_name2) ON CONFLICT REPLACE
I'm doing this based on the following:
© Stack Overflow or respective owner