Difference between revisions of "MySQL/INSERT"
< MySQL
Jump to navigation
Jump to search
(Created page with "==Usage== "INSERT" implies "INSERT INTO"; the "INTO" is always optional. Inserting a list of values:<source lang=mysql>INSERT table_name(col1,col2,col3...) VALUES (value1, val...") |
|||
| Line 1: | Line 1: | ||
| − | == | + | {{fmt/title|"INSERT" SQL statement|see also: [[MariaDB/SQL/INSERT|in MariaDB]]}} |
| − | "INSERT" implies "INSERT INTO"; the "INTO" is always optional. | + | ==Examples== |
| − | Inserting a list of values: | + | Note: "<code>INSERT</code>" implies "<code>INSERT INTO</code>"; the "<code>INTO</code>" is always optional. |
| − | Inserting the contents of another table or query (NOT YET VERIFIED): | + | * Inserting a list of values:{{fmt/syntax/block|SQL|INSERT table_name(col1,col2,col3...) VALUES (value1, value2, value3...)}} |
| + | * Inserting the contents of another table or query (NOT YET VERIFIED):{{fmt/syntax/block|SQL|INSERT table_name(col1,col2,col3...) SELECT col1,col2,col3 FROM...}} | ||
==Links== | ==Links== | ||
* [https://dev.mysql.com/doc/refman/8.0/en/insert.html MySQL 8.0 Reference Manual] | * [https://dev.mysql.com/doc/refman/8.0/en/insert.html MySQL 8.0 Reference Manual] | ||
Latest revision as of 21:43, 18 February 2025
|
"INSERT" SQL statement see also: in MariaDB
|
Examples
Note: "INSERT" implies "INSERT INTO"; the "INTO" is always optional.
- Inserting a list of values:
INSERT table_name(col1,col2,col3...) VALUES (value1, value2, value3...)
- Inserting the contents of another table or query (NOT YET VERIFIED):
INSERT table_name(col1,col2,col3...) SELECT col1,col2,col3 FROM...