Of course, allows "duplicate" rows to be inserted if one (or more) of the 
fields are NULL:

sqlite> create table x(x int, y int, unique (x,y));
sqlite> insert into x values (1,1);
sqlite> insert into x values (NULL,1);
sqlite> insert into x values (1,NULL);
sqlite> insert into x values (1,1);
Error: UNIQUE constraint failed: x.x, x.y
sqlite> insert into x values (NULL,1);
sqlite> insert into x values (1,NULL);

If NULLs need to be considered equal, then you have to use a trigger.  If there 
is no intention to use NULLs then the table definition should say that.

> On 21 Oct 2016, at 10:53pm, Rick Kohrs <rick.ko...@ssec.wisc.edu> wrote:
> 
> > All fields would match in an existing record compared to that of a
> proposed new record. That help?
> 
> So if two rows had all fields identical except for segment, they are not
> identical ?  Okay, in that case
> 
> CREATE UNIQUE INDEX him_all
>     ON himawari_db (dateTime, filename, satID, year, month, day, hour,
> minute, band       , coverage, region, segment, server);
> 
> This will mean it's impossible to insert the second row.  The command
> 
> INSERT OR IGNORE ...
> 
> will then not insert the second row, without causing an error.
> 
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to