Reputation: 854
I have a table with an id column, an email column, and a password column. The id column is set to primary key and auto increment as shown here:
Using MySQL workbench, I'm sending
INSERT INTO users VALUES ('a', 'b')
but it says that the "column count doesnt match the value count at row 1" which to me means that it's expecting 3 values and not 2. But according to this post, I should be able to just use two values as the id column will auto increment itself.
Clearly I am wrong about something because this is not working. What am I doing wrong?
Upvotes: 0
Views: 1040
Reputation: 1270873
Always include the column list when using insert
(unless you really know what you are doing):
INSERT INTO users(email, password)
VALUES ('a', 'b');
The id column will be auto incremented, if it is set to auto increment.
Upvotes: 3