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,210 points
1,038 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,320 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
194 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,810 points
584 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
• 57,640 points
161 views
0 votes
1 answer

How to install MySQL in windows?

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

answered Feb 27, 2019 in Database by Priyaj
• 57,640 points
144 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,210 points
130 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,810 points
268 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,210 points
701 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,320 points
7,252 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 in Database by Okugbe
• 240 points
298 views