Seth Woolley's Man Viewer

delete(7) - DELETE - delete rows of a table - man 7 delete

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

DELETE(7)                        SQL Commands                        DELETE(7)



NAME
       DELETE - delete rows of a table


SYNOPSIS
       DELETE FROM [ ONLY ] table [ WHERE condition ]


DESCRIPTION
       DELETE  deletes  rows  that satisfy the WHERE clause from the specified
       table. If the WHERE clause is absent, the effect is to delete all  rows
       in(1,8) the table. The result is a valid, but empty table.

              Tip: TRUNCATE [truncate(2,7)(7)] is a PostgreSQL extension which pro-
              vides a faster mechanism to remove all rows from a table.


       By default, DELETE will delete rows in(1,8) the specified table and all  its
       subtables.  If  you  wish  to  only delete from the specific table men-
       tioned, you must use the ONLY clause.

       You must have the DELETE privilege on the table to delete from  it,  as
       well as the SELECT privilege for any table whose values are read(2,n,1 builtins) in(1,8) the
       condition.

PARAMETERS
       table  The name (optionally schema-qualified) of an existing table.

       condition
              A value expression that returns a value  of  type  boolean  that
              determines the rows which are to be deleted.

OUTPUTS
       On successful completion, a DELETE command returns a command tag of the
       form

       DELETE count

       The count is the number of rows deleted. If count is 0, no rows matched
       the condition (this is not considered an error(8,n)).

EXAMPLES
       Delete all films but musicals:

       DELETE FROM films WHERE kind <> 'Musical';


       Clear the table films:

       DELETE FROM films;


COMPATIBILITY
       This command conforms to the SQL standard.



SQL - Language Statements         2003-11-02                         DELETE(7)

References for this manual (incoming links)