Home > Database > Mysql Tutorial > How to insert multiple pieces of data in mysql?

How to insert multiple pieces of data in mysql?

青灯夜游
Release: 2020-10-02 11:37:52
Original
22526 people have browsed it

Mysql method of inserting multiple pieces of data: 1. Use the "INSERT INTO table name field list VALUES (value 1) ..., (value n);" statement to insert data; 2. Use "INSERT INTO table name SET Field 1 = value 1, field 2 = value 2,..." statement inserts data.

How to insert multiple pieces of data in mysql?

#After the database and table are successfully created, data needs to be inserted into the database table. In MySQL, you can use the INSERT statement to insert one or more rows of tuple data into an existing table in the database.

Basic syntax

The INSERT statement has two syntax forms, namely the INSERT…VALUES statement and the INSERT…SET statement.

1) INSERT...VALUES statement

The syntax format of INSERT VALUES is:

INSERT INTO <表名> [ <列名1> [ , … <列名n>] ]
VALUES (值1) [… , (值n) ];
Copy after login

The syntax is explained as follows.