Home > Database > Mysql Tutorial > How to add multiple pieces of data in sql?

How to add multiple pieces of data in sql?

藏色散人
Release: 2020-09-16 11:26:39
Original
32921 people have browsed it

How to add multiple pieces of data in sql?

SQL method to add multiple pieces of data:

1. Add one record

insert into tableName(num1,num2,num3) values (1,2,3)
Copy after login

2. --Add multiple Records ①

insert into tableName(num1,num2,num3)   
select 3,4,5   
union all  //添加所有,包括重复项,使用union不添加重复项,最后一项不写union
select 6,7,8
Copy after login

3. --Add multiple records ②

insert into tableName (num1,num2,num3)
values
(1,2,3),
(4,3,4),
(1.23,9);
Copy after login

The above is the detailed content of How to add multiple pieces of data in sql?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
sql
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template