Microsoft Access: Deleting Records



To delete all records of a table, use the following formula:


Here is an example:

DROP TABLE Students;

When this statement executes, all records from a table named Students would be created (but the table and its columns would be kept).

To delete only some records, use the following formula:

DELETE Something
FROM   TableName
WHERE  ColumnName = Value;

In Microsoft Access SQL, the Something factor is required but plays little to no significant role. In the WHERE expression, specify the name of the column and the value that will be used to isolate the record to delete.

Here is an example:

FROM Employees
WHERE EmployeeNumber = 825502;

In this case, the record whose employee number is 825502 will be deleted.

The Delete Query

To delete a group of records in one action, you can create a Delete Query.

A Delete Query allows you to select the necessary fields of a table. The first difference between this and the Select Query is that the Delete Query, selects or considers all fields, even those you do not include in your statement. The other columns are those that would be used to specify the rules under which a record must be deleted.




Home Copyright © 2008-2016, FunctionX, Inc.