1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
10 HREF="mailto:pgsql-docs@postgresql.org"><LINK
12 TITLE="PostgreSQL 7.4.1 Documentation"
13 HREF="index.html"><LINK
15 TITLE="Data Manipulation"
19 HREF="dml-update.html"><LINK
22 HREF="queries.html"><LINK
25 HREF="stylesheet.css"><META
27 CONTENT="2003-12-22T03:48:47"></HEAD
33 SUMMARY="Header navigation table"
43 >PostgreSQL 7.4.1 Documentation</TH
51 HREF="dml-update.html"
67 >Chapter 6. Data Manipulation</TD
96 >6.3. Deleting Data</A
105 > So far we have explained how to add data to tables and how to
106 change data. What remains is to discuss how to remove data that is
107 no longer needed. Just as adding data is only possible in whole
108 rows, you can only remove entire rows from a table. In the
109 previous section we discussed that SQL does not provide a way to
110 directly address individual rows. Therefore, removing rows can
111 only be done by specifying conditions that the rows to be removed
112 have to match. If you have a primary key in the table then you can
113 specify the exact row. But you can also remove groups of rows
114 matching a condition, or you can remove all rows in the table at
121 > command to remove rows; the
122 syntax is very similar to the <TT
126 For instance, to remove all rows from the products table that have a price of 10, use
128 CLASS="PROGRAMLISTING"
129 >DELETE FROM products WHERE price = 10;</PRE
133 > If you simply write
135 CLASS="PROGRAMLISTING"
136 >DELETE FROM products;</PRE
138 then all rows in the table will be deleted! Caveat programmer.
146 SUMMARY="Footer navigation table"
157 HREF="dml-update.html"