Oracle 5.0 Reference Manual page 1129

Table of Contents

Advertisement

Single-table syntax:
UPDATE [LOW_PRIORITY] [IGNORE]
SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
[WHERE where_condition]
[ORDER BY ...]
[LIMIT row_count]
Multiple-table syntax:
UPDATE [LOW_PRIORITY] [IGNORE]
SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
[WHERE where_condition]
For the single-table syntax, the
table with new values. The
be given. Each value can be given as an expression, or the keyword
explicitly to its default value. The
rows to update. With no
rows are updated in the order that is specified. The
that can be updated.
For the multiple-table syntax,
satisfy the conditions. In this case,
is an expression that evaluates to true for each row to be updated. For expression
where_condition
syntax, see
Section 9.5, "Expression
and
table_references
"SELECT
Syntax".
You need the
UPDATE
updated. You need only the
The
statement supports the following modifiers:
UPDATE
• With the
LOW_PRIORITY
reading from the table. This affects only storage engines that use only table-level locking (such as
MyISAM, MEMORY, and MERGE).
• With the
keyword, the update statement does not abort even if errors occur during the
IGNORE
update. Rows for which duplicate-key conflicts occur are not updated. Rows for which columns are
updated to values that would cause data conversion errors are updated to the closest valid values
instead.
If you access a column from the table to be updated in an expression,
of the column. For example, the following statement sets
UPDATE t1 SET col1 = col1 + 1;
The second assignment in the following statement sets
the original
value. The result is that
col1
from standard SQL.
UPDATE t1 SET col1 = col1 + 1, col2 = col1;
Single-table
assignments are generally evaluated from left to right. For multiple-table updates,
UPDATE
there is no guarantee that assignments are carried out in any particular order.
If you set a column to the value it currently has, MySQL notices this and does not update it.
If you update a column that has been declared
SQL mode is enabled; otherwise, the column is set to the implicit default value for the column data type
UPDATE
table_reference
table_references
statement updates columns of existing rows in the named
UPDATE
clause indicates which columns to modify and the values they should
SET
clause, if given, specifies the conditions that identify which
WHERE
clause, all rows are updated. If the
WHERE
updates rows in each table named in
UPDATE
ORDER BY
Syntax".
where_condition
[578]
privilege only for columns referenced in an
[578]
privilege for any columns that are read but not modified.
SELECT
keyword, execution of the
col1
1109
Syntax
DEFAULT
ORDER BY
clause places a limit on the number of rows
LIMIT
and
cannot be used.
LIMIT
are is specified as described in
is delayed until no other clients are
UPDATE
to one more than its current value:
col1
to the current (updated)
col2
and
have the same value. This behavior differs
col2
by setting to NULL, an error occurs if strict
NOT NULL
to set a column
clause is specified, the
table_references
Section 13.2.8,
that are actually
UPDATE
uses the current value
UPDATE
value, not
col1
that

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents