Return to IFS 105 Notes!

Access
Project 2

Querying a Database
Using the
Select Query Window

Querying a Database

Select Query Window
(2 parts)

  1. Top portion - contains fields of tables which can be used in query
  2. Bottom portion - contains field, show, criteria, sort, and total information that can be used to set-up the query parameters

Running a Query

Note: dynamic because if table changes on which the query depends the results of query will change along with it.

Note: Run button changes to Print Preview

2 Views of Query

  1. Design View - used to set-up query
  2. Print Preview View - shows dynaset of query

General Terms

Wildcards
2 Special kinds

  1. Asterisk (*) - collection of characters
  2. Question mark (?) - individual character
Example: criteria row Fa* for Name field

Creating a Parameter Query

Example: [Enter City] for City field in Criteria row

Note: parameter queries useful in cases where query run frequently with slight changes to criteria.

Using Compound Criteria
(2 types)

  1. AND criteria - each individual criterion must be true in order for the compound criterion to be true.
        To combine criteria with AND, place criteria on same line.
  2. OR criteria - either or both criterion must be true in order for the compound criterion to be true.
        To combine criteria with OR, criteria must be entered on separate line (using OR row on QBE grid)

Sorting Data in Query

Note: can’t sort on an asterisk (used to add all fields of table to QBE grid)

Note: major key must appear to left of minor key in QBE grid (if another order is desired in dynaset, must include major key twice in QBE grid and hide leftmost major key)

Creating a Top-Values Query

Example find top 25%: click Top Values Box and select 25% after sorting the data in descending order.

Joining Tables

Note: One of the key features that distinguishes DBMS from file systems is the ability to join tables. (create queries that draw on data from two or more tables)

Note: Several types of joins are available, the kind used here in called a natural join the most common type.

Calculated Fields in Query

Example: Net Pay:[Gross Pay] - [Deductions]
Note: Field Names in expression must be enclosed in brackets

Calculating Statistics

Note: to use any of these functions include them in Total Row of QBE grid

Grouping

Crosstab Queries

In the Lab 2
(HOMEWORK #8)

End

Querying a Database
Using the Select Query Window

 

Computer Assignment 8

Return to IFS 105 Notes!