Name
INSERT
Synopsis
INSERT [LOW_PRIORITY|DELAYED|HIGH_PRIORITY] [IGNORE]
[INTO] table
SET column={expression|DEFAULT}, ...
[ON DUPLICATE KEY UPDATE column=expression, ... ]
INSERT [LOW_PRIORITY|DELAYED|HIGH_PRIORITY] [IGNORE]
[INTO] table [(column, ...)]
VALUES ({expression|DEFAULT},...),(...),...
[ON DUPLICATE KEY UPDATE column=expression, ... ]
INSERT [LOW_PRIORITY|DELAYED|HIGH_PRIORITY] [IGNORE]
[INTO] table [(column, ...)]
SELECT...Use
this statement to add rows of data to a table. Three statement
structures are available. The first syntax format, the
INSERT...tableSET... method, can insert only one row of data per
statement. The second syntax structure shown, the
INSERT...table(columns)
VALUES(values)
method, can handle one or more rows in one statement. The columns and
their order are specified once, but values for multiple rows may be
given. Each row of values is to be contained in its own set of
parentheses, separated by commas. The third syntax structure for this
statement, the
INSERT...table...SELECT...
method, allows columns from rows in other tables to be inserted.
Explanations of each type of statement, their various clauses and
flags, and examples of their use follow.
Single-row insertion with SET clause
INSERT [LOW_PRIORITY|DELAYED|HIGH_PRIORITY] [IGNORE]
[INTO] table
SET column={expression|DEFAULT}, ...
[ON DUPLICATE KEY UPDATE column=expression, ... ]This method of the
INSERT statement allows only one row of data to be inserted into a table at a time. Each column name ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access