English 中文(简体)
MS Access - Query Data
  • 时间:2024-11-05

MS Access - Query Data


Previous Page Next Page  

A query is a request for data results, and for action on data. You can use a query to answer a simple question, to perform calculations, to combine data from different tables, or even to add, change, or delete table data.

    As tables grow in size they can have hundreds of thousands of records, which makes it impossible for the user to pick out specific records from that table.

    With a query you can apply a filter to the table s data, so that you only get the information that you want.

    Queries that you use to retrieve data from a table or to make calculations are called select queries.

    Queries that add, change, or delete data are called action queries.

    You can also use a query to supply data for a form or report.

    In a well-designed database, the data that you want to present by using a form or report is often located in several different tables.

    The tricky part of queries is that you must understand how to construct one before you can actually use them.

Create Select Query

If you want to review data from only certain fields in a table, or review data from multiple tables simultaneously or maybe just see the databased on certain criteria, you can use the Select query. Let us now look into a simple example in which we will create a simple query which will retrieve information from tblEmployees table. Open the database and cpck on the Create tab.

Create Select

Cpck Query Design.

Query Design

In the Tables tab, on the Show Table dialog, double-cpck the tblEmployees table and then Close the dialog box.

Show Table

In the tblEmployees table, double-cpck all those fields which you want to see as result of the query. Add these fields to the query design grid as shown in the following screenshot.

Add Fields

Now cpck Run on the Design tab, then cpck Run.

Design

The query runs, and displays only data in those field which is specified in the query.

Advertisements