eHow launches Android app: Get the best of eHow on the go.

How To

How to Create an SQL Delete Query in Access

Contributor
By C.D. Crowder
eHow Contributing Writer
(0 Ratings)

Microsoft Access allows you to create SQL queries. These queries require a basic knowledge of the SQL programming language. Many users prefer creating SQL queries versus regular Access queries. More advanced queries can be created through this method than through Access's design view screen. For beginners, Access does provide the two basic clauses needed to create an SQL Delete query.

Difficulty: Moderate
Instructions
  1. Step 1

    Open an existing Microsoft Access database with at least one existing table. Access queries by clicking "Queries" in the main database window.

  2. Step 2

    Open or create a new query. Open a query by highlighting the desired query and pressing "Design." Note that the query should already be a delete query or one that you wish to change to a delete query.

    Create a new query by choosing "Create a new query in design view." A blank query design window will open. Choose at least one table from the table list to select fields from.

  3. Step 3

    Press the "Query Type" button on the query toolbar and select "Delete" to create a basic delete query. This is required if you want the correct clauses in place in SQL View. Choose any fields you want in your delete query as well for further assistance once you switch views.

  4. Step 4

    Press the "View" button on the query toolbar. Use the drop-down arrow beside the button to select "SQL View."

  5. Step 5

    Begin your delete query with the clause "DELETE". Type the fields you wish to delete, separated by commas, on the same line. Use the format TableName.FieldName. Press "Enter" and type the clause "FROM". Type the table name you wish to select the field names from. End the "FROM" line with a semicolon.

    For instance, a simple SQL Delete query would be typed as follows:
    DELETE SampleTable.FirstField, SampleTable.SecondField
    FROM SampleTable;

  6. Step 6

    Add any desired criteria such as a number value or specific text by using the term "WHERE" plus your criteria within parentheses.

    For instance, the SQL Delete query would now look like the following:
    DELETE SampleTable.FirstField, SampleTable.SecondField
    FROM SampleTable
    WHERE (SampleTable.FirstField = "ThisText");

    Note that the semicolon is now at the end of the last line of the query. Semicolons are used to denote the end of the query and will only appear at the end of your last line.

Tips & Warnings
  • Table names and field names are case sensitive.
  • All SQL Delete queries must have a DELETE and FROM line. The query will not run without both.

References

Resources

Post a Comment

Post a Comment
  • Have you done this? Click here to let us know.
I Did This

Related Ads

Computers
Alexia Petrakos,

Meet Alexia Petrakos eHow's Computers Expert.

Get Free Computers Newsletters

Copyright © 1999-2009 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy.   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

eHow Computers
eHow_eHow Technology and Electronics