MySQL error 1136, why can I not add these entries to my table

Code

Error

I don’t know why I keep getting an error

Thank you in advance

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

INSERT syntax allows inserting multiple rows, but each row needs to be in its own tuple:

insert into shoppinglistTest(itemdescription, quantity, dateadded)
values
('Bananas',20,'0000-00-00'),
('apples',10,'0000-00-00'),
('grapes',20,'0000-00-00'),
('gatorade',10,'0000-00-00'),
('steak',10,'0000-00-00'),
('milk',2,'0000-00-00'),
('eggs',4,'0000-00-00');

The syntax you tried to use used a single tuple of 21 values for a column list of 3 columns. The number of columns in your column list must be the same as the number of values in each tuple in the VALUES clause. But you can make a list of many tuples.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x