I know this is an older thread, but shouldn't that reference be on the ITEM table ? So ...
CREATE TABLE ATTRIBUTES ( ITEM_ID INTEGER REFERENCES ITEM(ID) ON DELETE CASCADE, KEY TEXT, VALUE TEXT, PRIMARY KEY (ITEM_ID,KEY) ) WITHOUT ROWID; John G On 11 September 2017 at 13:11, Kees Nuyt <k.n...@zonnet.nl> wrote: > On Mon, 11 Sep 2017 14:05:25 +0200, Kees Nuyt <k.n...@zonnet.nl> > wrote: > > > CREATE TABLE ATTRIBUTES ( > > ITEM_ID INTEGER REFERENCES ATTRIBUTES(ID) ON DELETE CASCADE, > > KEY TEXT, > > VALUE TEXT, > > PRIMARY KEY (ITEM_ID,KEY) > > ) WITHOUT ROWID; > > CREATE INDEX attr_item_id ON ATTRIBUTES(ITEM_ID); > > Correction: > In this construct, it makes no sense to create the index > attr_item_id, because the ITEM_ID is the first column > of the primary key (which is indexed implicitly). > > So, you can leave out the CREATE INDEX attr_item_id > statement in this case. > > -- > Regards, > > Kees Nuyt > _______________________________________________ > 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