Microsoft Access
Project 2Project 2
Objectives
• State the purpose of queriesState the purpose of queries• Create a new queryCreate a new query• Use a query to display all records Use a query to display all records
and all fieldsand all fields• Run a queryRun a query• Print the answer to a queryPrint the answer to a query• Close a queryClose a query• Clear a queryClear a query
Objectives cont…
• Use a query to display selected Use a query to display selected fieldsfields
• Use text data and wildcards in Use text data and wildcards in criteriacriteria
• Use numeric data and Use numeric data and comparison operators in criteriacomparison operators in criteria
• Use compound criteriaUse compound criteria• Sort the answer to a criteriaSort the answer to a criteria
Objectives cont…
• Join tables in a query and Join tables in a query and restrict the records in a joinrestrict the records in a join
• Use calculated fields in a Use calculated fields in a queryquery
• Calculate statistics in a query Calculate statistics in a query • Save a query and use a Save a query and use a
saved querysaved query
Introduction
• QueryQuery• A question represented in a A question represented in a
way that Access can way that Access can understand and answerunderstand and answer
Project Two – Querying the Alisa Vending Services Database
• The ModelThe Model
Opening the Database
• File OpenFile Open• Select the database you Select the database you
which to openwhich to open
Creating a New Query
• Using the Select Query WindowUsing the Select Query Window• First create a new Select Query First create a new Select Query
WindowWindow
Creating a New Query
• Displaying Selected Fields in Displaying Selected Fields in a Querya Query
Creating a New Query
• Running a QueryRunning a Query
Creating a New Query
• Printing the Results of a QueryPrinting the Results of a Query
Creating a New Query
• Returning to the Select Returning to the Select Query WindowQuery Window
Creating a New Query
• Closing a QueryClosing a Query
Including All Fields in a Query
Clearing the Design Grid
Entering Criteria
• Using Text Data in CriteriaUsing Text Data in Criteria
Entering Criteria
• Using WildcardsUsing Wildcards
Entering Criteria
• Criteria for a Field Not in the Criteria for a Field Not in the ResultResult
Click to see Figure 2-25Click to see Figure 2-25
Click to see Figure 2-26Click to see Figure 2-26
Click to see Figure 2-27Click to see Figure 2-27
Entering Criteria
• Using Numeric Data in Using Numeric Data in CriteriaCriteria
Entering Criteria
• Using Comparison OperatorsUsing Comparison Operators
Using Compound Criteria
• Using AND CriteriaUsing AND Criteria
Using Compound Criteria
• Using OR CriteriaUsing OR Criteria
Sorting Data in a Query
• To Sort Data in a QueryTo Sort Data in a Query
Sorting Data in a Query
• Omitting DuplicatesOmitting Duplicates
Sorting Data in a Query
• Sorting on Multiple KeysSorting on Multiple Keys
Joining Tables
• Restricting Records in a JoinRestricting Records in a Join
Using Calculated Fields in a Query
Calculating Statistics
• Calculating StatisticsCalculating Statistics
Calculating Statistics
• Using Criteria in Calculating Using Criteria in Calculating StatisticsStatistics
Calculating Statistics
• GroupingGrouping
Saving a Query
Closing a Database
• Click the Close Window Click the Close Window button for the Alisa Vending button for the Alisa Vending Services : Database windowServices : Database window