UPDATE
cannot modify data in the primary key column of a table.- Call FLUSH after
UPDATE
to persist the changes to storage. This ensures that the changes are committed and visible for subsequent reads.
Syntax
Parameters
Parameter or clause | Description |
---|---|
table_name | The table whose rows you want to update. |
SET col_name = value | Assign a value or result of an expression to a specific column.col_name cannot be a primary key. |
WHERE condition | Specify which rows you want to update using an expression that returns a boolean value. Rows for which this expression returns true will be updated. If you omit the WHERE clause, all rows in the table will be updated. Subqueries are supported in the condition expression. |
RETURNING | Returns the values of any column based on each updated row. |
Example
Thetaxi_trips
table has three records: