Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of batch insert data in mysql

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the method of mysql batch insert data, which has a certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

Mysql batch insert data methods: 1, circular insertion; 2, reduce connection resources, splice a sql;3, use stored procedures; 4, use [MYSQL LOCAL_INFILE].

Mysql batch insert data method:

Method 1: circular insertion

This is also the most common way, if the amount of data is not very large, you can use it, but you have to consume the resources to connect to the database every time.

The general thinking is as follows

(I write pseudo code here, which can be written in combination with my own business logic or framework syntax.)

For ($itim1bot / value) {$sql = 'insert.';//querysql} while ($I exec ($sql); if (! $res) {/ / TODO insert failure} @ unlink ($my_file) }} Thank you for reading this article carefully. I hope the editor's method of sharing mysql batch insert data will be helpful to everyone. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report