The DELETE Statement

The DELETE statement has only three keywords: DELETE, FROM, and WHERE. You can see the diagram of the DELETE statement in Figure 17-1.

Figure 17-1. The syntax diagram of the DELETE statement

We said that the DELETE statement is perhaps the simplest statement in SQL, and we weren’t kidding! But it’s also the most dangerous statement that you can execute. If you do not include a WHERE clause, the statement removes all the rows in the table you specify. This can be useful when you’re testing a new application, for example, so you can empty all the rows from existing tables but keep the table structure. ...

Get SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.