September 4, 2025: PostgreSQL 18 RC 1 Released!
Supported Versions: Current (17) / 16 / 15 / 14 / 13
Development Versions: 18 / devel
Unsupported versions: 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.
2.8. Updates
Prev Up Chapter 2. The SQL Language Home Next

2.8. Updates

You can update existing rows using the UPDATE command. Suppose you discover the temperature readings are all off by 2 degrees after November 28. You can correct the data as follows:

UPDATE weather
 SET temp_hi = temp_hi - 2, temp_lo = temp_lo - 2
 WHERE date > '1994-11-28';

Look at the new state of the data:

SELECT * FROM weather;
 city | temp_lo | temp_hi | prcp | date
---------------+---------+---------+------+------------
 San Francisco | 46 | 50 | 0.25 | 1994年11月27日
 San Francisco | 41 | 55 | 0 | 1994年11月29日
 Hayward | 35 | 52 | | 1994年11月29日
(3 rows)

Prev Up Next
2.7. Aggregate Functions Home 2.9. Deletions

AltStyle によって変換されたページ (->オリジナル) /