Home>Article>Database> How to use insert into statement in mysql

How to use insert into statement in mysql

PHPz
PHPz forward
2023-05-26 16:40:06 2668browse

General form of insert into statement in mysql

insert [into] 表名 [(列名1, 列名2, 列名3, ...)] values (值1, 值2, 值3, ...);

Three ways to write insert into statement in mysql

1. Insert a record into some fields in the original table.

insert into +表名(表中的字段,,)value(字段所对应的记录,,);

2. Method 1 of inserting multiple records into the fields in the original table.

insert into +表名(表中的字段,,)values(字段所对应的记录,,)(字段所对应的记录);

3. Method 2 of inserting multiple records into the fields in the original table.

语法:insert into+表名 select v1,v2 union all

The above is the detailed content of How to use insert into statement in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete