Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UNIQUE constrains in Android SQLite database

Tags:

android

sqlite

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!

like image 306
sammiwei Avatar asked Mar 24 '26 00:03

sammiwei


1 Answers

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.

like image 148
kosa Avatar answered Mar 26 '26 14:03

kosa