Lastly in this section, we examine the use of DML statements to remove data from the database.
As important as it is to be able to add and change data, sometimes data needs to be removed from a database. For example, say that a company keeps an opt-in mailing list. When a customer opts-in to receive mailings from the company, their information is placed into a table called
mailing_list. If the customer decides that they no longer want to receive information from the company, they can opt-out of the mailings. In such a situation, the information should be removed from the
mailing_list table. In SQL, we remove data from a table using the
DELETE statement. Its syntax tree is shown ...