Coupon Accepted Successfully!


Types of Queries

Access enables you to create the following types of Queries
  1. Select - This type of query displays data from one or more tables, based on user - defined criteria.
  2. Find Duplicate - This type of query displays all records with duplicate values in a specific field. For example, you can find out details of customers who have bought more than one product.
  3. Find Unmatched - This type of query displays all records that do not have a matching record in another table. For example, you can find details of customers who have not bought any product.
  4. Parameter - This type of query, when executed, displays a dialog box in which you can enter the criterion for retrieving data. This enables you to customize the output of your query based on the value that you enter while executing it.
  5. Crosstab - This type of query calculates a sum or count and groups the results of the query. For example, you can display the items grouped first by Category and within the category by suppliers.
  6. Update - This type of query is used to make changes in the records in a table. For example, to change the price of a product from Rs.10 to Rs. 12.50.
  7. Append - This type of query adds records extracted from one table to another table.
  8. Delete - This type of query deletes records from tables, based on a specified criterion.
  9. Make - Table - This type of query creates a new table from a group of records extracted from other tables.
Update, Append, Delete and Make - table queries are called Action queries as they perform actions on the record that meet the specified criteria.

Creating Queries in Access

A complete view of data stored access various tables is achieved only by executing queries based on SQL. A query is capable of displaying data records contained in many data tables. There are many types of queries in Access that are used to generate reports which are given below-
  1. Simple Query - This type of query enables us to identify a field from the database. For example, to find amount of transactions record contained in voucher no. - 01, we can use the following SQL statement:
FROM Vouchers
WHERE Voucher no - '01'

In the above SQL statement, the SELECT statement is meant to specify the field to be selected, FROM clause specifies the source of data, and WHERE clause filters the records matching the condition that Voucher No = '01'.
  1. Parameter Queries - This type of query is used to identify a set of records which contains the same criteria. Consider, to search voucher records of a particular account from the Accounts database, we can use the following SQL Query:
FROM Accounts
WHERE Code = Account No.


  1. Summary Queries - This query type is of particular importance in accounting because it enables us to create accounting reports based on summarization of transaction data.
Example- SELECT Code, Name, Sum (Amount)
FROM Vouchers INNER JOIN Accounts
ON (Accounts, Code = Vouchers.Debit)
GROUP BY Code, Name

Methods of Creating Queries

Access provides the following two methods of creating a query:
  1. Using Design View - The Design view enables you to create a query from scratch. It enables you to specify the tables, fields and criteria of a query.
  2. Using Query Wizard - The Query Wizard displays a series of dialog boxes in which you can specify the tables and fields that you want to include in the query.
To create Queries, we have to take the following steps:
  1. Click Queries in the Objects Bar in the Database window.
  2. Double click the Create Query in Design view option.

At this point, show Table Dialog box is displayed:
  1. Click Tables to opt for the name of the table that you want to add to the query.
  2. Click the Add button
  3. Repeat these steps till you add all the required tables.
  4. Click the close button.
    At this point, show Table dialog box is closed and the Select Query Window is displayed.
  5. Click the name of the table from which you want to add a field to the query in the dropdown list box in the Table row.
  6. Click the name of the field from which you want to use in the query from the dropdown list box in the Field row
  7. Click the show option if you want to display the field in the output of the query.
  8. If there is a criteria for the field, type it in the Criteria Field.
  9. Type the name of the query in the Query Name box.
  10. Click OK
    The query is saved.
Show the dialog box giving results.


SQL View Method to create a Query: It is also a method of creating Query in Access. This type of SQL Query statement is written by using the keyboard. While forming the SQL statement, the following clauses are normally used for generating queries:
  1. SELECT - This clause is used to specify the fields to display data which were given after SELECT in the SQL Statement. SELECT Vno., Name, Amount
  2. INNER - This clause is used to display matching records between two data tables. To make relation between two data tables, we have to type Join after the clause. For example, if we have to select those records of Debit Voucher and credit Voucher table whose category ID and TYPE respectively are the same, we can use the following SQL statement.
    FROM Credit voucher INNER JOIN Debit Voucher
    ON (CatId = Type)
  3. LEFT - This clause in a SQL query statement enables the display of matching records of those tables along with the records (matched and unmatched) given in the first table in the statement. Consider the following example:
    FROM Credit Voucher LEFT JOIN Debit Voucher
    ON (CatId = Type)

    This statement will display all records of Credit Voucher along with the matching records of Debit Voucher.
  4. RIGHT - This clause is the opposite of the LEFT Clause and displays all records of Debit Voucher along with the matching records of Credit Vouchers, the statement is as given below:
    FROM Credit Voucher RIGHT JOIN Debit Voucher
    ON (CatId = Type)
  5. ORDER BY - By using this clause in SQL query statement, we get the result in the order in which the resultant records of the query are required to appear.
    ORDER BY Type, Code
  6. GROUP BY - This clause is used in the SQL statement to provide grouping of records for creating a summary. For example,
    SELECT Credit, Sum (Amount)
    FROM Vouchers
    GROUP BY Credit
    This SQL statement results in display of the total amount by which every transaction has been credited.

Test Your Skills Now!
Take a Quiz now
Reviewer Name