Home  >  Article  >  Database  >  What is the sql command to add records to the database

What is the sql command to add records to the database

王林
王林Original
2020-06-22 14:53:068784browse

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,...);

Second form

Need to specify the column name and inserted value:

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

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);

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!

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