UPDATE

UPDATE

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.



Mastering MySQL 4
Mastering MySQL 4
ISBN: 0782141625
EAN: 2147483647
Year: 2003
Pages: 230
Authors: Ian Gilfillan

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net