Function
To delete tuples from a database table.
Syntax
DELETE FROM [ owner.]table-name ... [WHERE search-condition]
Description
The DELETE
statement deletes all the rows from the named table
that satisfy the search condition. If no WHERE
clause is
specified, all tuples in the named table are deleted.
Examples
DELETE FROM member
Deletes all tuples from the member table. Whoops!
DELETE FROM member WHERE member_id = 5
Deletes the tuple from the member table for member 5.
Because of the ON DELETE CASCADE
clauses in the pub
table (see Table Creation
Examples) the publications authored by member 5 and the borrowing
records for those publications will also be deleted. (However, the borrowing
records from the Borrowed for member 5 would have to be
removed before this DELETE
statement would work since Borrowed
lacks the ON DELETE CASCADE
clause.)
DELETE FROM Borrowed WHERE Date_Returned < '1995-01-01'
Deletes all borrowing records where the publication was returned before January 1st, 1995. (Cleaning out the old records).