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
Insert Zhang San’s information
INSERT INTO student VALUES ('Zhang San', 18)
Display the results, Zhang San is already in the data student table
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')
Display student data, Zhang San and Li Si are both in the table
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!