In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces Mysql using insert to insert multiple records batch new data method, has a certain reference value, interested friends can refer to, I hope you read this article after a lot of gains, the following let Xiaobian take you to understand.
If you want to insert 5 records into table1, the following is incorrect:
INSERT INTO table1 (id,name) VALUES(1, Xiao Ming, 2, Xiao Qiang, 3, Xiao Du, 4, Xiao Li, 5, Xiao Bai);
MySQL will throw the following error
ERROR 1136: Column count doesn't match value count at row 1
The correct way to write it would be:
INSERT INTO t able1(i,name) VALUES(1,'Xiaoming'),(2,'Xiaoqiang'),(3,'Xiaodu'),(4,' Xiaoli'),(5,'Xiaobai');
Of course, column names can also be omitted in this way, so that the number of values in each pair of brackets must be the same, and this number must be the same as the number of columns. For example:
INSERT INTO t able1 VALUES(1,'Xiaoming '),(2,'Xiaoqiang'),(3,'Xiao Du'),(4,'Xiao Li'),(5,'Xiao Bai'); Thank you for reading this article carefully, I hope Xiaobian shared "Mysql uses insert to insert multiple records to add batch data method" This article is helpful to everyone, but also hope that everyone more support, pay attention to the industry information channel, more relevant knowledge 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.