sammiwei
sammiwei

Reputation: 3200

UNIQUE constrains in Android SQLite database

If I put one of my columns in Android SQLite database

"passed BOOLEAN NULL UNIQUE"

The UNIQUE constrain will not allow me to put duplicates of even NULL values? But if I do not set the values in the column, it is default to be null, so is this against the rule? Is there other way I could work around with the UNIQUE constrain? Thanks!

Upvotes: 3

Views: 2053

Answers (1)

kosa
kosa

Reputation: 66637

UNIQUE constraints allow for the value NULL. However, as with any value participating in a UNIQUE constraint, only one null value is allowed per column.

As per this link no work around except rearchitecting tables.

Upvotes: 4

Related Questions