I get a syntax error near AUTOINCREMENT
. What is the cause of this error?
CREATE TABLE person (
id INTEGER NOT NULL AUTOINCREMENT,
name TEXT NOT NULL
);
CREATE TABLE department (
id INTEGER NOT NULL AUTOINCREMENT,
name TEXT NOT NULL,
FOREIGN KEY (leader) REFERENCES person(id)
);
According to SQLite FAQ you have to declare either a INTEGER PRIMARY KEY
or INTEGER PRIMARY KEY AUTOINCREMENT
column to achieve that.