24.4.7 DELETE Statement
A SQL DELETE statement removes rows from a table. Its basic form is
DELETE FROM tableName WHERE criteria
where tableName is the table from which to delete. The optional WHERE
clause specifies the criteria used to determine which rows to delete. If this clause is omitted, all the table’s rows are deleted. The DELETE
statement
DELETE FROM Authors WHERE LastName = 'Black' AND FirstName = 'Sue'
deletes the row for Sue Black in the Authors
table. If we know the AuthorID
in advance of the DELETE
operation, the WHERE
clause can be simplified as follows:
WHERE AuthorID = 5
Figure 24.22 shows the Authors
table after the DELETE
operation has taken place.
Get Java™ How To Program (Early Objects), Tenth 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.