INSERT
Syntax
1065
There are several reasons to use the
HANDLER
interface instead of normal
SELECT
statements:
•
HANDLER
is faster than
SELECT
:
• A designated storage engine handler object is allocated for the
HANDLER ... OPEN
. The object
is reused for subsequent
HANDLER
statements for that table; it need not be reinitialized for each
one.
• There is less parsing involved.
• There is no optimizer or query-checking overhead.
• The handler interface does not have to provide a consistent look of the data (for example, dirty
reads are permitted), so the storage engine can use optimizations that
SELECT
does not normally
permit.
• For applications that use a low-level
ISAM
-like interface,
HANDLER
makes it much easier to port them
to MySQL.
•
HANDLER
enables you to traverse a database in a manner that is difficult (or even impossible) to
accomplish with
SELECT
. The
HANDLER
interface is a more natural way to look at data when working
with applications that provide an interactive user interface to the database.
HANDLER
is a somewhat low-level statement. For example, it does not provide consistency. That is,
HANDLER ... OPEN
does not take a snapshot of the table, and does not lock the table. This means
that after a
HANDLER ... OPEN
statement is issued, table data can be modified (by the current
session or other sessions) and these modifications might be only partially visible to
HANDLER ...
NEXT
or
HANDLER ... PREV
scans.
An open handler can be closed and marked for reopen, in which case the handler loses its position in
the table. This occurs when both of the following circumstances are true:
• Any session executes
FLUSH TABLES
or DDL statements on the handler's table.
• The session in which the handler is open executes non-
HANDLER
statements that use tables.
13.2.5.
INSERT
Syntax
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO]
tbl_name
[(
col_name
,...)]
{VALUES | VALUE} ({
expr
| DEFAULT},...),(...),...
[ ON DUPLICATE KEY UPDATE
col_name
=
expr
[,
col_name
=
expr
] ... ]
Or:
INSERT [LOW_PRIORITY | DELAYED | HIGH_PRIORITY] [IGNORE]
[INTO]
tbl_name
SET
col_name
={
expr
| DEFAULT}, ...
[ ON DUPLICATE KEY UPDATE
col_name
=
expr
[,
col_name
=
expr
] ... ]
Or:
INSERT [LOW_PRIORITY | HIGH_PRIORITY] [IGNORE]
[INTO]
tbl_name
[(
col_name
,...)]
SELECT ...
[ ON DUPLICATE KEY UPDATE
col_name
=
expr
[,
col_name
=
expr
] ... ]
INSERT
inserts new rows into an existing table. The
INSERT ... VALUES
and
INSERT ... SET
forms of the statement insert rows based on explicitly specified values. The
INSERT ... SELECT
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...