I am trying to auto increment a table with a single column which is a primary key, eg:
CREATE TABLE my_table (id PRIMARY KEY NOT NULL);
I would usually just not include the primary key column in the insert statment in order to autoincrement it, but this doesn’t seem possible in the case where there is only a single column. The below results in "syntax error at or near ")""
INSERT INTO my_table () VALUES ();
2
Answers
You can set value of id = Auto Value when insert
Ex:
Define your column as an identity then on insert specify the keyword DEFAULT.
Note: You do not use quotes around default. Demo here
But what is the point of such a table?