AUTOINCREMENT can only be used with INTEGER PRIMAY KEY columns in a rowid table definition to declare an alias for the rowid. Such columns must not have the DESC ordering (the rowid is ascending). If it does, then "PRIMARY KEY" is syntactic sugar for "UNIQUE" (ie, creating a unique index) and the AUTOINCREMENT keyword cannot be applied.
-----Original Message----- From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of sanhua.zh Sent: Wednesday, 19 July, 2017 20:07 To: sqlite-users Subject: [sqlite] A Descending Auto Increment Key When I call `CREATE TABLE test(i INTEGER PRIMARY KEY DESC AUTO INCREMENT)`, SQLite comes to an error "AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY". But as the document http://www.sqlite.org/lang_createtable.htmlsays, in the column-constraint, it shows that `PRIMARY DESC AUTOINCREMENT` is a valid syntax. Why the original SQL failed? Is that really not supported? _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users