DELETE Statement

Removes records from a specified table.






The DELETE statement has these parts:





The name of the table from which records are deleted.




The DELETE statement is especially useful when we want to delete many records. Unlike the UPDATE statement that can operate on queries, the DELETE statement can only delete records from tables.


To drop an entire table use the DROP TABLE statement. If we delete the table, however, the structure is lost. In contrast, when we use DELETE, only the data is deleted; the table structure and all of the table properties, such as column formatting and transfer rules, remain intact.


The DELETE statement deletes entire records, not just data in specific columns. If we want to delete values in a specific column, we use the UPDATE statement.


The DELETE statement is an action query and cannot be used from within the Manifold ODBC driver.




After we remove records using a DELETE query, we can't undo the operation. If we want to know which records were deleted, first examine the results of a SELECT query that uses the same criteria, and then run the DELETE query.


Maintain backup copies of data at all times. If we delete the wrong records, we can retrieve them from our backup copies.




Delete all records for employees whose title is Trainee:


DELETE FROM [Employees] WHERE [Title] = "Trainee";