Professional Documents
Culture Documents
Access
Create queries for a new
database
Lecture 4
1-3
CREATE QUERIES FOR A NEW DATABASE
Get answers from your data
Your new asset-tracking database is
1-4
CREATE QUERIES FOR A NEW DATABASE
Get answers from your data
Specifically, you’ll create select
queries. They’re components that
retrieve and process your data and
display the results in a datasheet.
1-5
CREATE QUERIES FOR A NEW DATABASE
Get answers from your data
The building blocks of a select query. Let’s start by looking at the parts of a
query.
1-6
CREATE QUERIES FOR A NEW DATABASE
The basics of creating select queries
1-7
CREATE QUERIES FOR A NEW DATABASE
The basics of creating select queries
Start by choosing a record source
for the query. A record source can
be one or more tables, one or more
queries, or a combination of the
two. The picture shows a table
open in the Query Designer.
The basic process for creating a query. From the record source, select the
fields that you want to see in the
query. The picture shows fields in
the Query Designer, but you do the
same thing in the Query Wizard. 1-8
CREATE QUERIES FOR A NEW DATABASE
Add any sorting, filtering, or other
The basics of creating select queries
selection criteria to your queries.
For example, if you use the criteria
shown in the picture, the query will
only return data for assets purchased
after May First of 2010. You can also
use criteria that make a query ask
you for input before it runs; you’ll see
that later in this course.
1-10
CREATE QUERIES FOR A NEW DATABASE
Ways to use query results
You can also use your record sets to
provide data for forms, reports, and
even other queries. For example, if you
want a report on the computers that you
need to replace, you can create a query
that returns that data, and then quickly
build your report.
1-11
CREATE QUERIES FOR A NEW DATABASE
Ways to use query results
The final two courses in this series show
you how to create forms and reports that
use queries as data sources. For now,
remember that unlike tables, record sets
don’t physically exist in your database.
Instead, Access stores the query, and it only
displays a record set when you run the
query.
A query as the data source for a report.
So let’s build one. We’ll start with the
Query Designer.
1-12
CREATE QUERIES FOR A NEW DATABASE
Query a single record source
1-13
CREATE QUERIES FOR A NEW DATABASE
Query a single record source Here’s the process.
1-15
CREATE QUERIES FOR A NEW DATABASE
Make a query ask for input
1-16
CREATE QUERIES FOR A NEW DATABASE
Make a query ask for input
Here’s how to use parameters in your queries:
Using criteria in a query. asks you for a start date, then an end
date, and it returns only the records
that fall within the dates you specify.
1-17
CREATE QUERIES FOR A NEW DATABASE
Use a formula in a query
1-18
CREATE QUERIES FOR A NEW DATABASE
Use a formula in a query
Open your query in Design view.
1-19
CREATE QUERIES FOR A NEW DATABASE
Query multiple record sources
You can use multiple tables, or other
queries, as the record source for a new
query. In fact, you’ll query multiple record
sources far more than you will single
sources. Multi-source queries are how
you answer questions such as which
assets came from which suppliers.
1-20
CREATE QUERIES FOR A NEW DATABASE
Query multiple record sources
On the Create tab, in the Queries
group, click Query Wizard.
1-21
Suggestions for practice
1. Create a select query from a single table.
2. Make the query ask for your input (add a parameter).
3. Add a calculated field to a query.
4. Format the calculated field.
5. Create a query from multiple tables.
6. Concatenate fields with an expression.
1-22
Test question 1
When you first create a query, you select which of the following? (Pick one
answer.)
1. A record source.
2. A system table.
3. A record set.
1-23
Test question 1
When you first create a query, you select which of the
following?
Answer:
1. A record source.
1-24
Test question 2
Use criteria in a query when you need to do which of the following? (Pick one
answer.)
1-25
Test question 2
Use criteria in a query when you need to do which of the
following?
Answer:
3. Sort, filter, or otherwise limit what the query returns.
1-26
Test question 3
Before you can use multiple tables as a record source,
those tables must: (Pick one answer.)
1-27
Test question 3
Before you can use multiple tables as a record source,
those tables must:
Answer:
2. Participate in a relationship.
1-28
Test question 4
An expression is: (Pick one answer.)
1-29
Test question 4
An expression is:
Answer:
3. An object that can perform calculations and other
tasks such as data validation.
1-30
Test question 5
This course has taught you everything you need to know about queries. (Pick one
answer.)
1. True.
2. False.
1-31
Test question 5
This course has taught you everything you need to know
about queries.
Answer:
2. False.
1-32
Quick Reference Card
For a summary of the tasks covered in this course, view the Quick Reference
Card.
1-33
Using this template
See the notes pane or view the full notes page (View tab, Notes
Page) for detailed help on this template.
1-34
Example In class
How many films with a rating of 5?
How many films that are either Musicals or Comedies?
How many films that have been directed by Gurinder
Chandha or George Lucas?
How many films featuring the following actors:
Arnold Schwarzenegger
Tom Cruise
How many science Fiction films made:
Before 1990
Between 1990 and 2000
After 2000
Films in the Star Wars series listed in the order they
were released
1-35
Example In class
How many films with a rating of 5?
How many films that are either Musicals or Comedies?
How many films that have been directed by Gurinder
Chandha or George Lucas?
How many films featuring the following actors:
Arnold Schwarzenegger
Tom Cruise and Helen Hunt
How many science Fiction films made:
Before 1990
Between 1990 and 2000
After 2000
Films in the Star Wars series listed in the order they
were released
1-36