This section is from the "Practical PostgreSQL" book, by John Worsley and Joshua Drake. Also available from Amazon: Practical PostgreSQL.
To remove a row, or all rows from a table, use the DELETE command. The syntax is:
DELETE FROM tablename WHERE condition ;
For instance, if the Book Town store does not carry books published by ABC Books and you want to delete it from the table, then use the command:
Example 4-33. Using DELETE
DELETE FROM publish WHERE publ_name='ABC Books';
The INSERT INTO command can be used to re-insert the data that you have just deleted from your publish table.
![]() | Caution with DELETE |
---|---|
If a condition is not specified, then the DELETE command removes ALL rows within that table. |
 
Continue to: