Home  >  Article  >  Database  >  What is the command to insert records in sql

What is the command to insert records in sql

尚
Original
2019-07-22 10:22:4116273browse

What is the command to insert records in sql

sql command to insert records is INSERT INTO.

Syntax 1:Add all fields

INSERT INTO table name VALUES (value 1, value 2,...)

to A simple student table example: students have two columns: name and age

What is the command to insert records in sql

Insert Zhang San’s information

INSERT INTO student VALUES ('Zhang San', 18)

What is the command to insert records in sql

Display the results, Zhang San is already in the data student table

What is the command to insert records in sql

Syntax 2: Specify columns to add(Columns that are not allowed to be empty must be given values, otherwise they cannot be inserted) INSERT INTO table_name (Column 1, Column 2,...) VALUES (Value 1, Value 2,....)

Insert information about John Doe

INSERT INTO student (NAME) VALUES ('John Doe')

What is the command to insert records in sql

Display student data, Zhang San and Li Si are both in the table

What is the command to insert records in sql

For more technical articles related to SQL, please visit SQL tutorial column to learn!

The above is the detailed content of What is the command to insert records 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 does sql refer to?Next article:What does sql refer to?