Error in near 'Autoincrement'

Viewed 31152

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)
);
4 Answers

SQLite AUTOINCREMENT : You Should Avoid Using It

Unless you create a table specifying the WITHOUT ROWID option, you get an implicit auto increment column called rowid.

The rowid column store 64-bit signed integer that uniquely identifies a row within the table.

It's an easy solution. Just use AUTOINCREMENT instead of AUTO_INCREMENT

Related