0
我試圖創建一個外鍵。檢查手冊1和2出來後,我寫了這個:sqlite3.OperationalError:在「REFERENCES」附近:語法錯誤 - 創建外鍵
db.execute("create table if not exists table1 (id integer PRIMARY KEY, somedata integer)")
db.execute("create table if not exists table2 (names text, REFERENCES maintable (id)")
,並得到這個:
sqlite3.OperationalError: near "REFERENCES": syntax error
我錯過了什麼?我如何創建外鍵? 謝謝。
sqlite_version是3.7.4
我想這說明,它沒有工作過。現在我得到了「sqlite3.OperationalError:near」)「:語法錯誤」 – fogbit 2011-03-30 17:31:20
你錯過了最後的括號 – 2011-03-30 17:32:28
的確。謝謝,問題解決了。我需要更加細心。 – fogbit 2011-03-30 17:36:28