Database Reference
In-Depth Information
Example 8: The following statement uses a query to update a row:
12.3 Deletion of Data
To remove rows from a table, the Delete statement is used. Alternately, you may use the
Truncate statement to delete all rows from a table. Figure 12-3 shows the syntax of both
statements.
Figure 12-3. The Delete Statement and the Truncate Statement
Example 9: Delete course 'C9999' from the database:
Note: The DBMS will not allow referenced tuples to be deleted unless DELETE
CASCADES was specified when the related foreign key(s) was (were) specified. The
default referential integrity for most DBMS suites is DELETE RESTRICTED.
Example 10: Delete all students that belong to Mary Seacole Hall:
Example 11: Delete all staff members:
or
Note: Examples 10 and 11 are illustrations of set-at-a-time deletions as mentioned
in Chapter 9. In the case of Example 10, all records satisfying the condition are deleted; in
the case of Example 11, all records are deleted from the table.
 
Search WWH ::




Custom Search