Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 3 Performing Queries
-
Upload
tiffany-leda -
Category
Documents
-
view
25 -
download
1
description
Transcript of Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 3 Performing Queries
Contents© Paradigm Publishing, Inc. 1
Contents© Paradigm Publishing, Inc. 2
Access 2010
Level 1
Unit 1 Creating Tables and Queries
Chapter 3 Performing Queries
Contents© Paradigm Publishing, Inc. 3
Performing Queries
Perform Queries CHECKPOINT 1 Design Queries with Aggregate Functions Create a Crosstab Query Create a Find Duplicates Query Create an Unmatched Query CHECKPOINT 2
Quick Links to Presentation Contents
Contents© Paradigm Publishing, Inc. 4
Perform Queries
Being able to extract (pull out) specific data from a table is one of the most important functions of a database.
Extracting data in Access is referred to as performing a query.
The word query means to ask a question.
Contents© Paradigm Publishing, Inc. 5
Perform Queries…continued
To design and perform a query:1. Open the desired
database.2. Click the Create tab.3. Click the Query
Design button in the Queries group.
continues on next slide…
Query Design button
Contents© Paradigm Publishing, Inc. 6
Perform Queries…continued
4. At the Show Table dialog box, click the desired table.5. Click the Add button.6. Add any additional tables.continues on next slide…
Show Table dialog box
Contents© Paradigm Publishing, Inc. 7
Perform Queries…continued
7. In the query design grid, click the down-pointing arrow in the Field row field.
8. Click the desired field from the drop-down list.
continues on next slide…
Field row field
Contents© Paradigm Publishing, Inc. 8
Perform Queries…continued
9. Click inside the Criteria row field in the column containing the desired field name.
10. Type the desired criterion.continues on next slide…
Criteria row field
Contents© Paradigm Publishing, Inc. 9
Perform Queries…continued
11. Click the Run button in the Results group.12. Save the query.
Run button
Contents© Paradigm Publishing, Inc. 10
Perform Queries…continued
You can click the down-pointing arrow at the right side of a Field row field and then click the desired field at the drop-down list.
You can also double-click a field in a table and it is inserted in the first available Field row field in the query design grid.
A third method for inserting a field in the query design grid is to drag a field from the table to the desired field in the query design grid.
Contents© Paradigm Publishing, Inc. 11
Perform Queries…continued
continues on next slide…
Typing this criteria Returns this“Smith” Field value matching Smith
“Smith” or “Larson” Field value matching either Smith or Larson
Not “Smith” Field value that is not Smith (the opposite of “Smith”)
“S*” Field value that begins with S and ends in anything
“*s” Field value that begins with anything and ends in s
Contents© Paradigm Publishing, Inc. 12
Perform Queries…continued
Typing this criteria Returns this
“[A-D]*” Field value that begins with A through D and ends in anything
#01/01/2012# Field value matching the date 01/01/2012
<#04/01/2012# Field value less than (before) 04/01/2012
>#04/01/2012# Field value greater than (after) 04/01/2012
Between #01/01/2012 And #03/31/2012
Any date between 01/01/2010 and 03/31/2012
Contents© Paradigm Publishing, Inc. 13
Perform Queries…continued
multiple criterion
In addition to performing several queries on specific tables, a query can also be performed on fields from more than one table.
Contents© Paradigm Publishing, Inc. 14
Perform Queries…continued
When you press the Enter key, Access changes the 1 to True.
When designing a query, you can extract records containing a check mark or records that do not contain a check mark.
Contents© Paradigm Publishing, Inc. 15
Perform Queries…continued
To sort fields in a query:1. At the query window, click in the Sort row field in the
query design grid.2. Click the down arrow in the Sort row field.3. Click the desired option.
Sort row field
Contents© Paradigm Publishing, Inc. 16
Perform Queries…continued
You can modify a saved query. Rather than designing a new query, open the existing
query, make any needed changes, and then run the query.
Contents© Paradigm Publishing, Inc. 17
Perform Queries…continued
To group and display multiple queries in the Navigation pane:1. Click the down-pointing
arrow in the Navigation pane Menu bar.
2. Click the Object Type option at the drop-down list.
Object Type option
Contents© Paradigm Publishing, Inc. 18
Perform Queries…continued
or row
The query design grid contains an or row that you can use to design a query that instructs Access to display records that match either of the two criteria.
Contents© Paradigm Publishing, Inc. 19
Perform Queries…continued
multiple criteria
You can also select records by entering criteria statements into more than one Criteria field. Multiple criteria all entered in the same row become an And statement where each criterion must be met for Access to select the record.
Contents© Paradigm Publishing, Inc. 20
Perform Queries…continuedTo create a query with the Simple Query Wizard:1. Click the Create tab.2. Click the Query Wizard
button in the Queries group.
3. Make sure that Simple Query Wizard is selected.
4. Click OK.5. Specify the table(s).6. Insert the fields.7. Click the Next button.continues on next slide…
first Simple Query Wizard dialog box
Contents© Paradigm Publishing, Inc. 21
Perform Queries…continued
8. At the second Simple Query Wizard dialog box, specify whether you want a detail or summary query.
9. Click the Next button.10. At the third Simple
Query Wizard dialog box, type a name and make any desired changes.
11. Click the Finish button.
third Simple Query Wizard dialog box
Contents© Paradigm Publishing, Inc. 22
Perform Queries…continued
To insert a calculated field:1. Click the Field row field.2. Type the desired field name followed by a colon.3. Type the equation.
equation
Contents© Paradigm Publishing, Inc. 23
CHECKPOINT 11) Being able to do this is one of the
most important functions of a database.a. reactb. interactc. detractd. extract
3) Click this option to sort from highest to lowest.a. Descendingb. Ascendingc. Alphabeticald. Chronological
2) This is the term used for the results of the query.a. answerb. resultsc. returnd. object
4) To insert a calculated field, type the desired field name followed by this symbol.a. plus signb. minus signc. colond. asterisk
Next Question
Next Question
Next Question
Next Slide
Answer
Answer
Answer
Answer
Contents© Paradigm Publishing, Inc. 24
Design Queries with Aggregate Functions
You can include an aggregate function such as Sum, Avg, Min, Max, or Count in a query to calculate statistics from numeric field values of all the records in the table.
When an aggregate function is used, Access displays one row in the query results datasheet with the formula result for the function used.
Contents© Paradigm Publishing, Inc. 25
Design Queries with Aggregate Functions…continued
To design a query with an aggregate function:1. At the query
window, click the Totals button in the Show/Hide group.
continues on next slide…Totals button
Contents© Paradigm Publishing, Inc. 26
Design Queries with Aggregate Functions…continued
2. Click the down-pointing arrow in the Total row field.
3. Click the desired aggregate function.
aggregate functions
Contents© Paradigm Publishing, Inc. 27
Design Queries with Aggregate Functions…continued
Group By option
Using the Group By option in the Total field you can add a field to the query upon which you want Access to group records for statistical calculations.
Contents© Paradigm Publishing, Inc. 28
Create a Crosstab Query
A crosstab query calculates aggregate functions such as Sum and Avg in which field values are grouped by two fields.
A wizard is included that guides you through the steps to create the query.
Contents© Paradigm Publishing, Inc. 29
Create a Crosstab Query…continued
To create a crosstab query:1. Click the Create tab.2. Click the Query Wizard button in the Queries group.3. Double-click the Crosstab Query Wizard option.4. Complete the wizard steps.
Crosstab Query Wizard option
Contents© Paradigm Publishing, Inc. 30
Create a Find Duplicates Query
Use the find duplicates query to search a specified table or query for duplicate field values within a designated field or fields.
A few other examples of how you can use a find duplicates query include: Find the records in an Orders table with the same customer
number so that you can identify your loyal customers. Find the records in a Customers table with the same last
name and mailing address so that you send only one mailing to a household to save on printing and postage costs.
Find the records in an EmployeeExpenses table with the same employee number so that you can see the employee who is submitting the most claims.
Contents© Paradigm Publishing, Inc. 31
Create a Find Duplicates Query…continued
To create a find duplicates query:1. Click the Create tab.2. Click the Query Wizard
button in the Queries group.
3. Double-click the Find Duplicates Query Wizard option.
4. Complete the wizard steps.
Find Duplicates Query Wizard
Contents© Paradigm Publishing, Inc. 32
Create an Unmatched Query
Create a find unmatched query to compare two tables and produce a list of the records in one table that have no matching record in the other related table.
Contents© Paradigm Publishing, Inc. 33
Create an Unmatched Query…continued
To create an unmatched query:1. Click the Create tab.2. Click the Query Wizard
button in the Queries group.
3. Double-click the Find Unmatched Query Wizard option.
4. Complete the wizard steps.
Find Unmatched Query Wizard
Contents© Paradigm Publishing, Inc. 34
CHECKPOINT 21) Sum, Avg, Min, Max, and Count
are examples of this type of function.a. informativeb. summativec. agitated. aggregate
3) This type of query calculates aggregate functions in which field values are grouped by two fields.a. unmatchedb. crosstabc. find duplicatesd. simple
2) To display the aggregate function list, click this button in the Show/Hide group.a. Functionsb. Showc. Displayd. Totals
4) Use this type of query if you suspect a record has inadvertently been entered twice under two different product numbers.a. unmatchedb. crosstabc. find duplicatesd. simple
Next Question
Next Question
Next Question
Next Slide
Answer
Answer
Answer
Answer
Contents© Paradigm Publishing, Inc. 35
Performing Queries
Design queries to extract specific data from tables Use the Simple Query Wizard to create queries Modify queries Design queries with Or and And criteria Create a calculated field Use aggregate functions in queries Create crosstab, duplicate, and unmatched queries
Summary of Presentation Concepts