The INSERT statement is used to insert new records into a database table. The syntax is: INSERT INTO table name (column 1, column 2, ...) VALUES (value 1, value 2, ...); the INSERT statement has the following variants: select data insertion from other tables or subqueries, If the primary key conflicts, the existing record will be updated. If the primary key conflicts, the insertion will be ignored. When no column name is specified, values are inserted in the order defined by the table; no value is required for auto-increment columns; the number of affected rows is 1 on successful insertion; an error is thrown on failure.
INSERT statement usage
The INSERT statement is used in SQL (Structured Query Language) to enter database tables Statement to insert new records. Its syntax is as follows:
<code>INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...)</code>
Usage instructions:
Syntax variations:
In addition to the basic syntax, the INSERT statement has the following variations:
Additional Notes:
The above is the detailed content of Usage of insert statement in SQL. For more information, please follow other related articles on the PHP Chinese website!