Removing Information with the DELETE Statement

In addition to adding data to a database, you will also need to delete data from a database. The syntax for the DELETE statement is

DELETE FROM tablename
WHERE condition

The first thing you will probably notice about the DELETE command is that it doesn't have a prompt. Users are accustomed to being prompted for assurance when, for instance, a directory or file is deleted at the operating system level. Are you sure? (Y/N) is a common question asked before the operation is performed. Using SQL, when you instruct the database management system (DBMS) to delete a group of records from a table, it obeys ...

Get Sams Teach Yourself SQL in 21 Days, 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.