Don't even get me started. Starbucks at night is not a good thing ! :lol: :lol:
DELETE
Name
DELETE -- delete rows of a table
Synopsis
DELETE FROM [ ONLY ] <VAR class=REPLACEABLE>table</VAR> [ WHERE <VAR class=REPLACEABLE>condition</VAR> ]</PRE>
Description
<TT class=COMMAND>DELETE</TT> deletes rows that satisfy the <TT class=LITERAL>WHERE</TT> clause from the specified table. If the <TT class=LITERAL>WHERE</TT> clause is absent, the effect is to delete all rows in the table. The result is a valid, but empty table.
Tip: TRUNCATE is an EnterpriseDB extension which provides a faster mechanism to remove all rows from a table.
By default, <TT class=COMMAND>DELETE</TT> will delete rows in the specified table and all its subtables. If you wish to only delete from the specific table mentioned, you must use the <TT class=LITERAL>ONLY</TT> clause.
You must have the <TT class=LITERAL>DELETE</TT> privilege on the table to delete from it, as well as the <TT class=LITERAL>SELECT</TT> privilege for any table whose values are read in the <VAR class=REPLACEABLE>condition</VAR>.
Parameters
<DL><DT><VAR class=REPLACEABLE>table</VAR> <DD>The name (optionally schema-qualified) of an existing table.
<DT><VAR class=REPLACEABLE>condition</VAR> <DD>A value expression that returns a value of type <TT class=TYPE>boolean</TT> that determines the rows which are to be deleted.
</DD></DL>
Outputs
On successful completion, a <TT class=COMMAND>DELETE</TT> command returns a command tag of the form
DELETE <VAR class=REPLACEABLE>count</VAR></PRE>The <VAR class=REPLACEABLE>count</VAR> is the number of rows deleted. If <VAR class=REPLACEABLE>count</VAR> is 0, no rows matched the <VAR class=REPLACEABLE>condition</VAR> (this is not considered an error).
Examples
Delete all films but musicals:
DELETE FROM films WHERE kind <> 'Musical';</PRE>
Clear the table <TT class=LITERAL>films</TT>:
DELETE FROM films;</PRE>
Compatibility
This command conforms to the SQL standard.