How to do a batch insert in MySQL

0 votes

I have 1-many number of records that need to be entered into a table. 

What is the best way to do this in a query?

Should I just make a loop and insert one record per iteration? Or is there a better way?

Sep 10, 2018 in Database by DataKing99
• 8,250 points
2,328 views

1 answer to this question.

0 votes

You can try out the following query:

INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
answered Sep 10, 2018 by Sahiti
• 6,370 points

Related Questions In Database

0 votes
1 answer

How to display the queries executed by a particular user in MySQL?

From the version 5.1.7 onward, MySQL allows ...READ MORE

answered Mar 7, 2019 in Database by Mishti
• 480 points
4,410 views
0 votes
1 answer

How to cache data in a MVC application?

Reference the System.Web dll in your model ...READ MORE

answered Oct 25, 2018 in Database by Frankie
• 9,830 points
1,845 views
+2 votes
1 answer

How to export data from MySql to a CSV file?

If you are using MySql workbench then ...READ MORE

answered Jan 4, 2019 in Database by Priyaj
• 58,020 points
1,583 views
0 votes
1 answer

How to install MySQL in windows?

You can download the all in one ...READ MORE

answered Feb 28, 2019 in Database by Priyaj
• 58,020 points
1,097 views
0 votes
1 answer

Why is not preferable to use mysql_* functions in PHP?

The reasons are as follows: The MySQL extension: Does ...READ MORE

answered Sep 7, 2018 in Database by DataKing99
• 8,250 points
1,280 views
0 votes
1 answer
0 votes
1 answer

How to connect to MySQL Database?

using MySql.Data; using MySql.Data.MySqlClient; namespace Data { ...READ MORE

answered Oct 12, 2018 in Database by Frankie
• 9,830 points
1,148 views
0 votes
1 answer

Fetch first 5 characters of the string

There are a lot of ways to ...READ MORE

answered Oct 22, 2018 in Database by DataKing99
• 8,250 points
5,909 views
0 votes
1 answer

Find values in a comma separated string in a MySQL query

You can add commas to the left and ...READ MORE

answered Sep 10, 2018 in Database by Sahiti
• 6,370 points
12,913 views
0 votes
2 answers

What are the ways to get the count of records in a table

With the help of the SQL count ...READ MORE

answered Aug 20, 2020 in Database by Okugbe
• 280 points
4,012 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP