Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 3 Performing Queries

35
Contents © Paradigm Publishing, Inc. 1

description

Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 3 Performing Queries. Performing Queries. Quick Links to Presentation Contents. Perform Queries CHECKPOINT 1 Design Queries with Aggregate Functions Create a Crosstab Query Create a Find Duplicates Query - PowerPoint PPT Presentation

Transcript of Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 3 Performing Queries

Page 1: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

Contents© Paradigm Publishing, Inc. 1

Page 2: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

Contents© Paradigm Publishing, Inc. 2

Access 2010

Level 1

Unit 1 Creating Tables and Queries

Chapter 3 Performing Queries

Page 3: Access 2010 Level 1 Unit 1Creating 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

Page 4: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 5: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 6: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 7: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 8: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 9: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

Contents© Paradigm Publishing, Inc. 9

Perform Queries…continued

11. Click the Run button in the Results group.12. Save the query.

Run button

Page 10: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 11: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 12: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 13: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 14: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 15: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 16: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 17: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 18: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 19: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 20: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 21: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 22: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 23: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 24: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 25: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 26: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 27: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 28: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 29: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 30: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 31: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 32: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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.

Page 33: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 34: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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

Page 35: Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter  3 Performing Queries

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