By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,327 Members | 2,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,327 IT Pros & Developers. It's quick & easy.

How do you insert more than one row at a time?

P: 1
What if I have a large data set and want to insert more than 1 row at time? Is there a way to do it with the INSERT query? or do I have to use another QUERY?
Aug 21 '11 #1
Share this Question
Share on Google+
2 Replies

P: 1
You would need to put your insert commands in a file and then instruct MySQL to insert form the file

Expand|Select|Wrap|Line Numbers
  1. # mysql -h host -u user -p < batch-file
  2. Enter password: ******
Hope that helps
Aug 21 '11 #2

P: 122
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO tablename(col1, col2, col3) VALUES('a1', 'a2', 'a3'), ('b1', 'b2', 'b3'), ('c1', 'c2', 'c3');
Dec 3 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.