samedi 3 janvier 2015

what is missing in my sqlite syntax for foreign key?

I created two sqlite tables on android


phone table with primary key "id"



CREATE TABLE BLOCKED_PHONES_TABLE ( id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL DEFAULT 1, KEY_PHONE TEXT UNIQUE,KEY_IS_BLOCKED BIT )


comment table with foreign key "id"



CREATE TABLE COMMENTS_TABLE ( id INTEGER, KEY_COMMENT_TEXT TEXT, FOREIGN KEY(id) REFERENCES BLOCKED_PHONES_TABLE(id))


why does the comment table don't refer id as a foreign key?


otherwise it won't have ids that are missing in the phone table.


how can I know my sqlite version?


enter image description here enter image description here


Aucun commentaire:

Enregistrer un commentaire