Creating Delete Queries

See Also

You can delete multiple rows in one operation by using a Delete query. When you create a Delete query, you specify the database table to delete rows from and the search condition to define the rows you want to delete.

Note    Deleting all rows from a table clears the data in the table but does not delete the table itself. You can delete tables using the Database Designer. For information about using the Database Designer, see Database Designer.

For general information about using queries to update tables, see Modifying Data Using Queries.

When you create a Delete query, the Grid pane changes to reflect the options available for deleting rows. Because you do not display data in a Delete query, the Output, Sort By, and Sort Order columns are removed. In addition, the check boxes next to the column names in the input source window are removed because you cannot specify individual columns to delete.

Caution   You cannot undo the action of executing a Delete query. As a precaution, back up your data before executing a Delete query.

To create a Delete query

  1. Add the table to delete rows from to the Diagram pane.

  2. Start a Delete query by choosing Change Type from the Query menu or the Query Designer Toolbar, and then choosing Delete.

    Note   If more than one table is displayed in the Diagram pane when you start the Delete query, the Query Designer displays the Delete Table dialog box to prompt you for the name of the table to delete rows from.

  3. Enter search conditions to define the rows to be deleted. For details, see Specifying Search Conditions. If you do not specify a search condition, all rows in the specified table will be deleted.

    Note   Because you cannot delete the contents of individual columns, the check boxes in the input source window are removed when you start a Delete query. To add columns to the Grid pane to use in search conditions, drag them from the input source window to the Columns column, or select a data column in the Columns column.

When you execute the Delete query, no results are reported in the Results pane. Instead, a message appears indicating how many rows were deleted.