]> begriffs open source - ai-pg/blob - full-docs/txt/tutorial-update.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / tutorial-update.txt
1
2 2.8. Updates #
3
4    You can update existing rows using the UPDATE command. Suppose you
5    discover the temperature readings are all off by 2 degrees after
6    November 28. You can correct the data as follows:
7 UPDATE weather
8     SET temp_hi = temp_hi - 2,  temp_lo = temp_lo - 2
9     WHERE date > '1994-11-28';
10
11    Look at the new state of the data:
12 SELECT * FROM weather;
13
14      city      | temp_lo | temp_hi | prcp |    date
15 ---------------+---------+---------+------+------------
16  San Francisco |      46 |      50 | 0.25 | 1994-11-27
17  San Francisco |      41 |      55 |    0 | 1994-11-29
18  Hayward       |      35 |      52 |      | 1994-11-29
19 (3 rows)