If you want to insert 5 records into table1, the following is wrong: INSERT INTO table1 (id,name) VALUES(1,Xiaoming,2,Xiaoqiang,3,Xiaodu,4,Xiaoli,5,Xiaobai); MySQL will throw the following error ERROR 1136: Column count doesn't match value count at row 1 The correct way to write it should be like this: INSERT INTO table1(i,name) VALUES(1,'Xiao Ming'),(2,'Xiao Qiang'),(3,'Xiao Du'),(4,'Xiao Li'),(5,'Xiao Bai'); Of course, you can also omit the column name in this way, so the number of values in each pair of brackets must be the same, and this number must be consistent with the number of columns. like: INSERT INTO table1 VALUES(1,'Xiao Ming'),(2,'Xiao Qiang'),(3,'Xiao Du'),(4,'Xiao Li'),(5,'Xiao Bai'); Summarize The above is what I introduced to you about using insert in Mysql to insert multiple records in batches of new data. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: How to Set Shortcut Icons in Linux
>>: js to upload pictures to the server
First put a piece of code for(int i=0;i<1000;i...
HTML is the abbreviation of Hypertext Markup Langu...
The commonly used escape characters in HTML are s...
Swarm Cluster Management Introduction Docker Swar...
This article mainly introduces the Mysql backup m...
Port mapping is not the only way to connect Docke...
This article shares with you a small Demo that ad...
Overflow Hide It means hiding text or image infor...
The smallest scheduling unit in k8s --- pod In th...
Table of contents Preface: 1. Create index method...
Think big and small, then redirect. Sometimes Lin...
Table of contents rc.local method chkconfig metho...
Table of contents What is a partition table Parti...
Find the installation directory of VirtualBox. Th...
Preface: When we use Vue, we often use and write ...