Update
Modifies the values of column data within a table.
Synopsis
UPDATE [ ONLY ] table SET column = expression [, ...] [ FROM fromlist ] [ WHERE condition ]
Parameters
ONLYThe optional
ONLYkeyword indicates to only update the specifiedtable(and not its inheriting child tables, if it has any).tableThe name of an existing table to update.
columnThe name of a column to update in the table you specified.
expressionAn expression or value that you want assigned to the specified column.
fromlistA valid table, view, or other
from_itemas defined in the reference entry titled “SELECT.” A PostgreSQL extension of theUPDATEcommand is the ability to use column values from other tables within theWHEREcondition; to do this correctly, you must use this parameter to list the tables from which you will be pulling column values.conditionThe
WHEREcondition forUPDATEto use when determining what rows are to be updated. This can be any valid expression resulting in a value of typeboolean.
Results
UPDATEcountThe message returned when an
UPDATEwas successful. Thecountwill actually be the number of rows that were modified as a result of theUPDATE. For example, ifcountis zero, it means that no rows were updated.ERROR: Relation 'table' does not existThe error returned if
tableis not a table in the connected database.ERROR: Relation 'table' does not have attribute 'column'The error returned if a
columnthat does not exist in thetableis used in theSETclause.ERROR: Cannot update a view without ...