I am using SQLite 3.8.11 for Mac OS X app . My goal is to create a table and then inside reference some field in other table. For example:
CREATE TABLE artist(
artistid INTEGER PRIMARY KEY,
artistname TEXT
);
CREATE TABLE track(
FOREIGN KEY(trackartist) REFERENCES artist(artistid)
);
However, I want to insert trackartist into track so that each row will contain unique trackartist value. In case the trackartist value is already inside the track - the new value must be ignored. How can I do that in this setting? UPDATE OR IGNORE command seems not working, values are duplicated.
Aucun commentaire:
Enregistrer un commentaire