Update Table
You are looking at an older version of the documentation. The latest version is found here.
Usage
You can update a table using aliases:
UPDATE <schema>.<table> [[AS] <alias>]
SET <alias>.<columnname> = value
Examples
1. For a table with columns A
, B
:
CREATE TABLE dwh.test_table (a integer, b integer) ;;
INSERT INTO dwh.test_table VALUES(1, 2);;
INSERT INTO dwh.test_table VALUES(3, 4);;
2. Update without AS:
UPDATE dwh.test_table x SET x.a = 100 WHERE x.b = 2 ;;
3. Update with AS:
UPDATE dwh.test_table AS x SET x.a = 1000 WHERE x.b = 2 ;;
See Also
UPDATE statement with two tables for a workaround for referencing a second table in a JOIN
clause