csv - How do I import data into a table with composite key in SQLite? -
so have table composite key defined follows:
create table book_review ( isbn varchar(13) not null, id_num int not null, rating int not null, review varchar(8000), primary key (isbn, id_num), foreign key (isbn) references book(isbn) on delete cascade on update cascade, foreign key (id_num) references contact(id_num) on delete cascade on update cascade );
the problem i'm having when import data formatted csv file, duplicate entry error. it's true there duplicate entries isbn, , there duplicate entries id_num in table, composite key of (isbn, id_num) unique each row. why getting error?
i can omit primary key declaration , import fine, need primary key defined correctly.
i've tried importing table without primary key definition, moving data temp table, dropping table , recreating primary key constraint, trying move back...but expected "duplicate entry" error pops again.
any idea how populate table composite key importing directly formatted csv file?
Comments
Post a Comment