What is a Query?

A query is a question that requires some data from the database. Which is created by specifying fields to display from a table or another query? It can also determine the condition for extracting data. And select records from one or more tables in a database. These extracted records can be used for analysis. The resulting collection of files called a dynaset (short for the dynamic subset). It will be updated whenever the tables are updated.

Uses of Query

  • Extract records according to the specified criteria.
  • Choose the fields to display in the result.
  • Sort the records in a specific order.
  • Calculate fields and summarize data.
  • A query can be given a name, and it can be saved; it can also be used repeatedly.

Advantages of Query

The query can be executed against multiple tables. In the of related tables query join them and extract the data as a single dataset. It is a flexible way of manipulating data in a database. It provides facilities to add, remove, modify and search data. They are easy to use. Anyone can execute query just by double-clicking it.

Types of Queries

There are two types of queries described as follows.

Crosstab

These queries are used to calculate and restructure data for a more straightforward analysis of data. These queries calculate a sum, average, count, or another type of total for data that is grouped by two kinds of information, one down the left side of the datasheet and another across the top.

Parameter

You can design the query to prompt you for more-than-one piece of information. For example, You can develop it to inspire you for two dates. Access can then retrieve all records that fall between those two dates.

How to create a Query using the Design view?

Following are the steps to create a query in design view.

  • From the database window, select queries object.
  • Now select create a query in design view option from right side pane.
  • A show table dialog box will appear with the name of tables.
  • Select the required tables by pressing Add button dr just by a double click.
  • Add fields from the tables to the query grid by double-clicking.
  • Enter the criteria for the query in the criteria field.

Specifying Criteria

To do this, you specify criteria that limit the results to records whose Country field is “Japan.” To specify criteria for a field in the design grid, enter an expression in the Criteria cell for that field. The expression in the preceding example would be “Japan.” You can use more complicated expressions, however, such as “Between 1000 And 5000”.

Wild Cards

Wildcard characters are used as placeholders for other characters when you are specifying a value you want to find and you know only part of the cost.

Leave a Reply