|
|
UPDATE [LOW_PRIORITY] [IGNORE] table_name SET field_name1= expression1 [, field_ name2=expression2, ...] [WHERE where_clause] [LIMIT #]
The UPDATE statement updates the contents of existing rows in the database.
The SET clause specifies which fields to update and what the new values are to be.
The where_clause gives conditions the row must adhere to in order to be updated.
IGNORE causes MySQL to ignore UPDATEs that would cause a duplicate primary key or unique key, instead of aborting the UPDATE.
The LOW PRIORITY keyword causes the UPDATE to wait until no other clients are reading the table before processing it.
The expression can take the current value of a field; for example, to add 5 to all employees' commissions, you could use the following:
UPDATE employee SET commission=commission+5;
LIMIT determines the maximum number of records to be updated.
|
|