On occasion, an application may need to remove existing records in a data source. This can be done using the DELETE statement. The DELETE statement has the following general syntax:
DELETE
FROM tablename
WHERE condition
Omitting the WHERE clause in a DELETE statement causes the delete operation to be applied to all rows in the specified table. Therefore, it is important to always provide a WHERE clause with a DELETE statement unless you explicitly want to erase all data stored in a table. If you want to delete all of the records in a table, deleting the table itself may be more efficient than running a delete query. You can use the DROP TABLE statement to drop a table from the database. If you delete the table, however, the structure is lost. In contrast, when you use DELETE only the data is deleted. The table structure and all of the table properties, such as field attributes and indexes, remain intact.
A delete query deletes entire records, not just data in specific fields. If you want to delete values in a specific field, use an UPDATE statement that changes the values to NULL.
Once you remove records using a delete query, they are gone for good. If you want to know which records will be deleted, first examine the results of a select query that uses the same criteria, and then run the delete query.