Home > Database > Mysql Tutorial > body text

What is the sql command to add records to the database

王林
Release: 2020-06-22 14:53:06
Original
8668 people have browsed it

What is the sql command to add records to the database

The sql command to add records to the database is INSERT INTO.

(Recommended learning: mysql tutorial)

The syntax of the INSERT INTO statement

The INSERT INTO statement can be written in two forms, respectively Yes:

First form

There is no need to specify the column name to insert data, just provide the inserted value:

INSERT INTO table_name
VALUES (value1,value2,value3,...);
Copy after login

Second form

Need to specify the column name and inserted value:

INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);
Copy after login

Example:

insert into #tblInsert(Col1, Col2, Col3, Col4) values('张三', 30, 9850.5, 1);
insert into #tblInsert(Col1, Col2, Col3, Col4) values('李四', 40, 10000, 0);
insert into #tblInsert(Col1, Col2, Col3, Col4) values('王五', 50, 8753.15, 1);
Copy after login

The above is the detailed content of What is the sql command to add records to the database. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!