The UPDATE StatementThe UPDATE statement updates data in one or more rows. UPDATE takes the name of the table to be updated, as well as the rows to be affected, and the new values. The following example updates a single row in a table: UPDATE products SET product_price=49.99 WHERE product_id=235 The WHERE clause restricts the rows being updated, and without it, all rows are updated. The following example increases the price of all products by 10: UPDATE products SET product_price=product_price+10 To update multiple columns, you must separate each column=value pair with a comma. CAUTION Care must be taken to ensure that a WHERE clause is specified where needed (usually it will be). If you want to update a single row, the WHERE clause should always filter by the primary key. |