Tuesday, May 3, 2011

Querying a Database - X


A query allows you to select and filter data from multiple tables.  Queries can be saved and utilized as often as you need them.
Query Wizard
The Query Wizard walks you through the steps to set up a query.  To run a query using the query wizard:
  • Click the Create tab
  • Click the Query Wizard button
Query Wizard Button
  • Choose the type of query you wish to run
  • Click OK
Query Wizard Screen One
  • Choose the fields you wish to include from each table
  • To select fields from different tables, click the Tables/Queries down arrow
  • Click Next
Query Wizard Screen 2

Insert pic of query wizard
  • Type in a title for the query
  • Click Finish
  • The query will display
Query Title Screen
To switch between tables and queries:
  • Open the Navigation Pane
  • Double click the name of the table or query you wish to view
Navigation Pane
Query Design Feature
You can also design a query with the  Query Design Button.  To design a query using the Query Design Button:
  • Click the Query Design Button on the Create tab
Query Design Button
  • Select the tables that you would like to query
  • Click Add
Add Query Tables
  • Double click the name of the field you would like to query
  • Repeat this process for as many fields as you would like in the query
Query Formulate Page

  • Click Run
Run Query Button
Query Criteria
Query criteria are search conditions used in a query to retrieve specific data.  You can set query criteria to be a specific number or data set, or you can set the criteria to be a range of data.
“value”
Will only display items that are that exact value (replace the word value with what you want to search by)
=
Is equal to
Less than
<=
Less than or equal to
Greater than
>=
Greater than or equal to
<> 
Not equal to
Between  X  And Y
Within a range (replace X & Y with values)
Is Null
Null values
And
True only if both conditions exist
Or
True if either condition exists
Not
True if the single instance is not true
To specify search criteria:
  • Click the query that you wish to add conditions
  • Type in the appropriate query criteria in the Criteria Box
Query Criteria

No comments:

Post a Comment