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

How to add multiple pieces of data in sql?

藏色散人
藏色散人Original
2019-05-13 13:36:5932898browse

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)

2. --Add multiple Records ①

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

3. --Add multiple records ②

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

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!

Statement:
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
Previous article:what is mysql serverNext article:what is mysql server