1 <REFENTRY ID="SQL-DELETE">
6 <REFMISCINFO>SQL - Language Statements</REFMISCINFO>
13 Deletes rows from a table
19 <DATE>1998-04-15</DATE>
22 DELETE FROM <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [ WHERE <REPLACEABLE CLASS="PARAMETER">condition</REPLACEABLE> ]
25 <REFSECT2 ID="R2-SQL-DELETE-1">
27 <DATE>1998-04-15</DATE>
43 <ReturnValue><replaceable class="parameter">table</replaceable></ReturnValue>
47 The name of an existing table.
53 <ReturnValue><replaceable class="parameter">condition</replaceable></ReturnValue>
57 This is an SQL selection query which returns the rows which
61 Refer to the SELECT statement for further description
72 <REFSECT2 ID="R2-SQL-DELETE-2">
74 <DATE>1998-04-15</DATE>
90 <ReturnValue> DELETE <replaceable class="parameter">count</replaceable></ReturnValue>
94 Message returned if items are successfully deleted. The
95 <replaceable class="parameter">count</replaceable> is the number
99 If <replaceable class="parameter">count</replaceable> is 0,
111 <REFSECT1 ID="R1-SQL-DELETE-1">
113 <DATE>1998-04-15</DATE>
119 DELETE removes rows which satisfy the WHERE <replaceable class="parameter">condition</replaceable>,
120 from the specified table.
123 If the <replaceable class="parameter">condition</replaceable> is absent,
124 the effect is to delete all rows in the table.
125 The result is a valid, but empty table.
128 You must have write access to the table in order to modify
129 it, as well as read access to any table whose values are
130 read in the <replaceable class="parameter">condition</replaceable>.
134 <REFSECT1 ID="R1-SQL-DELETE-2">
139 Remove all films but musicals:
142 DELETE FROM films WHERE kind <> 'Musical';
146 code |title |did| date_prod|kind |len
147 -----+-------------------------+---+----------+----------+------
148 UA501|West Side Story |105|1961-01-03|Musical | 02:32
149 TC901|The King and I |109|1956-08-11|Musical | 02:13
150 WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
153 Clear the table films:
159 code|title|did|date_prod|kind|len
160 ----+-----+---+---------+----+---
165 <REFSECT1 ID="R1-SQL-DELETE-3">
172 <REFSECT2 ID="R2-SQL-DELETE-4">
174 <DATE>1998-04-15</DATE>
180 SQL92 defines a different syntax for a positioned DELETE statement:
184 DELETE FROM <replaceable class="parameter">table</replaceable> WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
187 where <replaceable class="parameter">cursor</replaceable> identifies an open cursor.</para>
192 <!-- Keep this comment at the end of the file
197 sgml-minimize-attributes:nil
198 sgml-always-quote-attributes:t
201 sgml-parent-document:nil
202 sgml-default-dtd-file:"../reference.ced"
203 sgml-exposed-tags:nil
204 sgml-local-catalogs:"/usr/lib/sgml/catalog"
205 sgml-local-ecat-files:nil