5. Working with a Database : How You Can Access a Database with Standard SQL Statements : How You Can Use the Delete Statement
 
Share this page                  
How You Can Use the Delete Statement
The delete statement removes rows from a database table. You can delete all rows or, by using a where clause, only specified rows.
For example, assume that you want to remove all customers from the customer table whose accounts are closed. (The value for a closed account is stored in the CLOSED constant.) The following statement performs this task:
delete from customer where cstatus = CLOSED;
There are also query object and cursor versions of the delete statement. Both of these delete operations remove the current row when the statement is executed. For examples of query object and cursor delete statements, see How You Can Use Query Objects (see How You Can Use Query Objects) and How You Can Use Cursors to Access the Database (see How You Can Use Cursors to Access the Database).