Вы находитесь на странице: 1из 36

ParadigmPublishing,Inc.

Content
Content
s

Access 2013
Level 1
Unit 1

Creating Tables and


Queries
Chapter 3Performing Queries

ParadigmPublishing,Inc.

Content
Content
s

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
Create an Unmatched Query
CHECKPOINT 2

ParadigmPublishing,Inc.

Content
Content
s

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.

ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


To design and perform a query:
1. Click CREATE tab.
2. Click Query Design button.

Query Design
button

continues on next slide


ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


3. At Show Table dialog box, click desired
table, and then click Add button.
4. Add any additional tables. Show Table dialog
box

continues on next slide


ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


5. In query design grid,
click down-pointing
arrow in Field row field
and click desired field
from drop-down list.

Field row
field

continues on next slide


ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


6. Insert criterion.
7. Click Run button.

Criteria row
continues on field
next slide

ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


8. Save query.

Run
button

ParadigmPublishing,Inc.

Content
Content
s

Perform Queries - continued


To insert a field in the query design grid,
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.

ParadigmPublishing,Inc.

10

Content
Content
s

Perform Queries - continued


Typing this
criteria
Smith
Smith Or
Larson
Not Smith
s*
*s

Returns this
Field value matching Smith
Field value matching either
Smith or Larson
Field value that is not Smith
(the opposite of Smith)
Field value that begins with
S or s and ends in anything
Field value that begins with
anything and ends in S or s

continues on next slide


ParadigmPublishing,Inc.

11

Content
Content
s

Perform Queries - continued


Typing this
criteria
[A-D]*
#01/01/2015#
<#04/01/2015#
>#04/01/2015#
Between
#01/01/2015 And
ParadigmPublishing,Inc.
#03/31/2015

Returns this
Field value that begins
with A through D and ends
in anything
Field value matching the
date 01/01/2015
Field value less than
(before) 04/01/2015
Field value greater than
(after) 04/01/2015
Any date between
01/01/2015 and
Content
Content
12
03/31/2015
s

Perform Queries - continued


In addition to performing several queries on
specific tables, a query can also be
performed on fields from more than one
table.

multipl
e
criterio
n

ParadigmPublishing,Inc.

13

Content
Content
s

Perform Queries - continued


When designing a query, you can extract
records containing a check mark or records
that do not contain a check mark.

When you press the


Enter key, Access
changes the 1 to True.

ParadigmPublishing,Inc.

14

Content
Content
s

Perform Queries - continued


To sort fields in a
query:
1. At query window,
click in Sort row
field in query design
grid.
2. Click down arrow in
Sort row field.
3. Click Ascending or
Descending.

ParadigmPublishing,Inc.

15

Sort row
field

Content
Content
s

Perform Queries - continued


To insert a field
column:
1. Click in field
column that will
display
immediately right
of new column.
2. Click Insert
Columns button.

ParadigmPublishing,Inc.

Insert Columns
button

16

Content
Content
s

Perform Queries - continued


You can modify a saved query and use it for
a new purpose.
Rather than designing a new query, open
the existing query, make any needed
changes, and then run the query.

ParadigmPublishing,Inc.

17

Content
Content
s

Perform Queries - continued


To group and display
multiple queries in the
Navigation pane:
1. Click menu bar at top
of Navigation pane.
2. Click Object Type
option at drop-down
list.

Object Type
option

ParadigmPublishing,Inc.

18

Content
Content
s

Perform Queries - continued


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.

or row

ParadigmPublishing,Inc.

19

Content
Content
s

Perform Queries - continued


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.

multiple
criteria
ParadigmPublishing,Inc.

20

Content
Content
s

Perform Queries - continued


To create a query with
the Simple Query
Wizard:
1. Click CREATE tab.
2. Click Query Wizard
button.
3. Make sure Simple
Query Wizard is
selected.
4. Click OK.
5. Specify table(s).
6. Insert fields.
7. Click Next button.
ParadigmPublishing,Inc.

21

first Simple
Query Wizard
dialog box
Content
Content
s

Perform Queries - continued


8. At second Simple
Query Wizard dialog
box, specify whether
you want a detail or
summary query.
9. Click Next button.
10.At third Simple
Query Wizard dialog
box, type a name
and make any
desired changes.
11.Click Finish button.

ParadigmPublishing,Inc.

22

third Simple
Query Wizard
dialog box

Content
Content
s

Perform Queries - continued


To insert a calculated field:
1. Click Field row field.
2. Type field name followed by a colon.
3. Type equation.

equatio
n

ParadigmPublishing,Inc.

23

Content
Content
s

CHECKPOINT 1
1) Being able to do this is one
of the most important
functions of a database.
a. react
b. interact
c. detract
Answer
d. extract

3) Click this option to sort from


highest to lowest.
a. Descending
b. Ascending
c. Alphabetical
d. Chronological

2) This is the term used for


the results of the query.
a. answer
b. results
c. return
d. object

4) To insert a calculated field,


type the desired field name
followed by this symbol.
a. plus sign
b. minus sign
c. colon
d. asterisk
Answer

Next
Question

Answer

Answer
Next
Question

Next
Question
ParadigmPublishing,Inc.

Next Slide
24

Content
Content
s

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.

ParadigmPublishing,Inc.

25

Content
Content
s

Design Queries with Aggregate Functions continued

To design a query with an aggregate


function:
1. At query window, click Totals button.

Totals
button

continues on next slide

ParadigmPublishing,Inc.

26

Content
Content
s

Design Queries with Aggregate Functions continued

2. Click down-pointing arrow in Total row field.


3. Click desired aggregate function.

aggregate
functions
ParadigmPublishing,Inc.

27

Content
Content
s

Design Queries with Aggregate Functions continued

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.

Group By
option

ParadigmPublishing,Inc.

28

Content
Content
s

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.

ParadigmPublishing,Inc.

29

Content
Content
s

Create a Crosstab Query continued

To create a crosstab query:


1. Click CREATE tab.
2. Click Query Wizard button.
3. Double-click Crosstab Query Wizard.
4. Complete wizard steps.

Crosstab
Query
Wizard
option
ParadigmPublishing,Inc.

30

Content
Content
s

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.
Content
ParadigmPublishing,Inc.
31

Content
s

Create a Find Duplicates Query - continued

To create a find
duplicates query:
1. Click CREATE
tab.
2. Click Query
Wizard button.
3. Double-click
Find Duplicates
Query Wizard.
4. Complete wizard
steps.

ParadigmPublishing,Inc.

32

Find
Duplicates
Query
Wizard
dialog box

Content
Content
s

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 table.

ParadigmPublishing,Inc.

33

Content
Content
s

Create an Unmatched Query -continued


To create an
unmatched
query:
1. Click CREATE
tab.
2. Click Query
Wizard button.
3. Double-click Find
Unmatched
Query Wizard.
4. Complete wizard
steps.
ParadigmPublishing,Inc.

Find
Unmatched
Query
Wizard
dialog box
34

Content
Content
s

CHECKPOINT 2
1) Sum, Avg, Min, Max, and
Count are examples of this
type of function.
a. informative
b. summative
c. agitate
Answer
d. aggregate

Next
Question

2) To display the aggregate


function list, click this
button in the Show/Hide
group.
a. Functions
b. Show
c. Display
Answer
d. Totals
Next

Next
Question

ParadigmPublishing,Inc.

3) This type of query


calculates aggregate
functions in which field
values are grouped by two
fields.
a. unmatched
Answer
b. crosstab
Next
c. find duplicates
Question
4) d.
Usesimple
this type of query if
you suspect a record has
inadvertently been entered
twice under two different
product numbers.
a. unmatched
b. crosstab
c. find duplicates Answer
Next Slide
d. simple
35

Content
Content
s

Performing Queries
Summary of Presentation Concepts
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
ParadigmPublishing,Inc.

36

Content
Content
s

Вам также может понравиться