+ All Categories
Home > Documents > SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries,...

SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries,...

Date post: 25-Dec-2015
Category:
Upload: ethan-allen-lloyd
View: 215 times
Download: 2 times
Share this document with a friend
Popular Tags:
64
SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR” Operators Parameter Queries (or “Prompt Queries”) CrossTab Queries TopValue Queries Microsoft Access 2000 Class #5
Transcript
Page 1: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

SESSION 5.1

In this session we will be exploring Pattern Match QueriesList-Of-Values Queries, Non-Matching Values in QueriesBoth the “And” and the “OR” Operators Parameter Queries (or “Prompt Queries”) CrossTab Queries TopValue Queries

Microsoft Access 2000 Class #5

Page 2: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

TheThe MajorMajor Steps of a Steps of a MicroSoft Access MicroSoft Access

DatabaseDatabase TablesTables QueriesQueries FormsForms MacrosMacros ReportsReports ModulesModules

On our road map, we are here!On our road map, we are here!

Page 3: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Remember, a query is a question you ask about data stored in a database.

Page 4: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Pattern Match Queries, List-Of-Values Queries, Non-Matching Values in Queries, Both the “And” and the “OR” Operators and Parameter Queries (or “Prompt Queries”) are all simply normal select queries that use criteria.

The Criteria RowThe Criteria Row

Page 5: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Last session we looked at defining record selection by using criteria and creating calculated fields in Select queries.

The Criteria RowThe Criteria Row

Page 6: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

In this session we will look at specific criteria in Select queries.

The Criteria RowThe Criteria Row

Page 7: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Let’s take a quick look at the “Like”, “In”, “Not”, & the “And / Or” comparison operators that we will be using in our class exercise for this session.

The “Like” comparison operator (used in pattern matches) selects records by matching field values to a specific pattern that includes one or more wildcard characters - asterisk (*), question mark (?), and the number symbol (#).

Page 8: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

To show only those records with an area code of 313 you would enter this in the Phone Criteria Row

Page 9: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

In the previous example we used parentheses ( ) in our criteria expression.. If we had not needed the parentheses we could have simply typed 313* and Access would have inserted the word Like and the quotes for us.

Page 10: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The asterisk represents any string of characters, the question mark represents any single character, and the number symbol represents any single digit.

Using a pattern match is similar to using an exact match, except that a pattern match includes wildcard characters.

Page 11: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A list-of-values match selects records whose value for the selected field matches one of two or more simple condition values. You could accomplish this by including several “Or” conditions in the design grid, but Access also provides the “In” comparison operator that works as a shorthand.

Page 12: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The “In” comparison operator allows you to define a condition with two or more values.

If a record’s field value matches at least one value from the list of values, Access selects that record for inclusion in the query results.

Page 13: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

To show all records that contain CustomerNum 123, 135 and 202 you would enter this in the CustomerNum Criteria row

Page 14: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A non-matching value selects records whose value for the selected field does not match the simple condition value.

You create the selection criterion using the “Not” logical operator.

Page 15: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

To omit all states that begin with the letter M you would enter this in the State Criteria row

Page 16: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

You could also type just Not M* and Access would insert the Like and Quotes for you.

Page 17: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Let’s talk about something called compound conditions for a moment.

Barbara just came in and asked to see a list of all customers in Ohio and Michigan.

Notice the word “and” in Barbara’s request.

Page 18: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

What would happen if we typed “OH” And “MI” in the State Field’s Criteria Row?

Page 19: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The result would look something like this, not finding anything. That’s because we have asked Access to show us all records that contain both MI and OH in the same field.

Page 20: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

To answer Barbara’s question we would have to enter

Page 21: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

This criteria would return something like

Page 22: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

You have the option of entering this criteria in two ways

Page 23: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Using the second method as shown below

Would return only records in Ohio that contain “756” in the Phone field and every record in Michigan.

Page 24: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Using the second method as shown below

Would return only records in Ohio that contain “756” in the Phone field and only records in Michigan that contain “756” in the Phone field.

Page 25: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Hmm??

Lately it seems as though the questions are getting more and more intense!

Page 26: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

What if ?

Barbara especially is beginning to realize that many unsolved mysteries can be solved with this program by using queries.

Page 27: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

This has been causing Barbara’s Staff aconsiderable amountof concern.

Two things have beenhappening. First, more and more time has been spent creating queries.

Page 28: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Secondly, The number of queries is growingand it’s becomingmore and more difficult to keeptrack of whichquery is which.

There is an answer to this dilemma!

Page 29: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The wizards at Microsoft have come up with a very simple solution!

Page 30: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The solution is a parameter query!

Page 31: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A parameterquery is aquery thatprompts youfor criteriawhen the query is viewed or run. When Access runs the query, it will display a dialog box and prompt you to enter the criteria desired.

Page 32: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

To create a parameter query, simply enter the text that you want as your prompt in square brackets in the criteria row for the field that you want to set the criteria for.

Page 33: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Can I get summaries ?

Leonard is interested . in how much business . Valle Coffee is . doing in each . state! He wants . to know the . total sales by . state and by . month.

Page 34: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Is the Sunin the Sky?

The answer is “YES!”.“YES!”.

The solution is “CrossTab “CrossTab

Queries”!Queries”!

Page 35: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

and displays the results in a spreadsheet like format.

A Crosstab query performs aggregate (total) function

calculations on the values of one database field,

Page 36: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

through the steps for creating crosstab queries.

The quickest way to create a crosstab query is to use the Crosstab Query Wizard, which guides you

Page 37: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A Crosstab query can also display one additional aggregate function value that summarizes each row’s set of values.

Page 38: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The crosstab query datasheet below shows the total sales for each month by state and shows a row total.

Page 39: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

There are 3 other types of select queries that we need to take a quick look at.

Find DuplicatesFind UnmatchedTop Values

Page 40: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Finding duplicate records in very large databases can be a very distasteful and tedious task

Page 41: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A find duplicates query is a select query that locates duplicate records in a table or query.

Page 42: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

You can create this type of query using the Find Duplicates Wizard!

Page 43: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Finding unmatched records in very large databases can also be a very tedious task

Page 44: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

A find unmatched query is a select query that locates unmatched records in a related table.

Page 45: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

For example, if you can not establish referential integrity betweenthe Customer Tableand Order Table,you might have acustomer # in the ordertable that does not exist inthe customer table.

Page 46: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

You can create this type of query using the Find Unmatched Query Wizard!

Page 47: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The last select query that we will explore is called a

Top Values Query

Page 48: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Whenever you have a query that displays a large group of records, you can limit the number to a more manageable size by showing just the first 10 records for example.

Page 49: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The Top Values property for a query lets you limit the number of records in the query results. For the Top Values property, you enter either an integer (such as 10, to show the first 10 records) or a percent (such as 50%, to show the first half.)

Page 50: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The Top Values Query Button can be found on the Query Design Window’s Tool Bar as shown below:

Page 51: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Page AC 5.23

Quick Check Review

Page 52: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Quick Check ReviewReview

Let’s take a fewmoments to break upinto discussion groups.Each group will discussthe quick check questions on page AC 5.23 in your books. We will then review the answers at the end of the discussion.

Page 53: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Quick Check Review Session Review Session

5.15.1

1) What is a Lookup Wizard field?

Page 54: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Quick Check Review Session Review Session

5.15.12) What is a subdatasheet?

Page 55: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Quick Check Review Session Review Session

5.15.13) A(n) ___________ is a predefined format you use to enter data in a field.

Page 56: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Review Quick Check Review Session 5.1Session 5.1

4) Which comparison operator is used to select records based on a specific pattern?

Page 57: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Review Quick Check Review Session 5.1Session 5.1

5) What is the purpose of the asterisk (*) in a pattern match query?

Page 58: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Review Quick Check Review Session 5.1Session 5.1

6) When do you use the In Comparison operator?

Page 59: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Review Quick Check Review Session 5.1Session 5.1

7) How Do you negate a selection criterion?

Page 60: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Quick Check Review Quick Check Review Session 5.1Session 5.1

8) When do you use a parameter query?

Page 61: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Here we goagain !

Page 62: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

The staff at Valle Coffee have just finished their weekly meeting and as you can expect, there are more

questions than ever to be answered!

Page 63: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Your task today is to complete the exercises in Tutorial #5 Page AC 5.14 through Page AC 5.23

Page 64: SESSION 5.1 In this session we will be exploring Pattern Match Queries List-Of-Values Queries, Non-Matching Values in Queries Both the “And” and the “OR”

Please make a note that the disks to use for today’s class are:

Tutorial #5 Level 2 Disk1


Recommended