Removing Data: DELETE

It's just as important to be able to remove rows as it is to be able to add or change them. Like INSERT and UPDATE, DELETE works for single-row operations as well as for multiple-row operations, and like the other data modification statements, you can delete rows based on data in other tables.

The DELETE syntax looks like this:

DELETE FROM table_name
WHERE search_conditions

The WHERE clause specifies which rows to remove. If you decide to remove two rows from publishers—the rows added for publisher identification number 1622 and 1756—type this:

SQL
delete from publishers
where pub_id = '1622' or pub_id = '1756'

Note that once you delete the row that describes this publisher, you can no longer find the books the company ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.