0

This is really silly but I can't see where I am making the mistake: I am trying to add a foreign key to an existing table (sqlite3) with this sql statement:

ALTER TABLE tblDetail ADD FOREIGN KEY (master_id) REFERENCES tblMaster(id)

I get this error: near "FOREIGN": syntax error:

I can't see what I am doing wrong here. Any help would be greatly appreciated. Thank you.

TheSoul
  • 4,906
  • 13
  • 44
  • 74
  • `The only schema altering commands directly supported by SQLite are the "rename table" and "add column" commands`. See this link - https://sqlite.org/lang_altertable.html – kuro Apr 10 '17 at 05:52
  • Thanks for the answer – TheSoul Apr 13 '17 at 12:31

0 Answers0