I have multiple (composite) primary keys on a table and one of them will be auto increment. However, interestingly SQLite allows usage of AUTOINCREMENT
keyword just after an obligatory PRIMARY KEY
keyword.
My query is:
CREATE TABLE ticket (
id INTEGER PRIMARY KEY AUTOINCREMENT,
seat TEXT, payment INTEGER,
PRIMARY KEY (id, seat))
However the error is table "ticket" has more than one primary key
.
Actually I can avoid other primary keys for this table. But I am coding an ORM framework (hell yeah I'm crazy) and do not want to change structure of PRIMARY KEY
constraint generation for a table (because it is allowed in MySQL afaik).
Any solutions to this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…