Creating Delete Queries

Visual Database Tools

Visual Database Tools

Creating Delete Queries

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.

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 rectangle representing the table or table-structured object 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. Right-click in the Query Designer window, point to Change Type, and then choose 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 rectangle representing the table or table-structured object are removed when you start a Delete query. To add columns to the Grid pane to use in search conditions, drag them from the rectangle representing the table or table-structured object 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.

See Also

Supported Query Types