]> begriffs open source - ai-pg/blob - full-docs/txt/tutorial-delete.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / tutorial-delete.txt
1
2 2.9. Deletions #
3
4    Rows can be removed from a table using the DELETE command. Suppose you
5    are no longer interested in the weather of Hayward. Then you can do the
6    following to delete those rows from the table:
7 DELETE FROM weather WHERE city = 'Hayward';
8
9    All weather records belonging to Hayward are removed.
10 SELECT * FROM weather;
11
12      city      | temp_lo | temp_hi | prcp |    date
13 ---------------+---------+---------+------+------------
14  San Francisco |      46 |      50 | 0.25 | 1994-11-27
15  San Francisco |      41 |      55 |    0 | 1994-11-29
16 (2 rows)
17
18    One should be wary of statements of the form
19 DELETE FROM tablename;
20
21    Without a qualification, DELETE will remove all rows from the given
22    table, leaving it empty. The system will not request confirmation
23    before doing this!