I have a table named Books.
Its columns are indexNum, Bookname, Bookedition,
where indexNum is the primary key and is auto-incremented.
I’ve tried to insert data to the table, however the insert command is rejected.
I tried the following statements:
INSERT INTO Books VALUES ('', Birds, a12)
INSERT INTO Books VALUES (NULL, Birds, a12)
INSERT INTO Books VALUES (Bookname, Bookedition)( Birds, a12)
The first two statements do not work. The last statement worked the first time, however, the next time it says that the PK is duplicated.
How shall I insert many rows correctly?
Your syntax is a bit off. I would recommend using a column list. Take a look at the documentation on the correct syntax. Make sure that strings are encased in single quotes.