New Perspectives on Microsoft

Slides:



Advertisements
Similar presentations
Objectives Create an action query to create a table
Advertisements

Access 2007 ® Use Databases How can Microsoft Access 2007 help you structure your database?
® Microsoft Access 2010 Tutorial 5 Creating Advanced Queries and Enhancing Table Design.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Querying a Database Microsoft Office Access 2003.
1 Computing for Todays Lecture 16 Yumei Huo Fall 2006.
XP New Perspectives on Microsoft Access 2002 Tutorial 41 Microsoft Access 2002 Tutorial 4 – Creating Forms and Reports.
Copyright 2007, Paradigm Publishing Inc. BACKNEXTEND 3-1 LINKS TO OBJECTIVES Save a Filter as a Query Save a Filter as a Query Parameter Query Inner, Left,
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Database Applications – Microsoft Access Lesson 9 Designing Special Queries Updated 4/11.
Tutorial 8 Advanced Queries. Notes Switch to new database! Tutorial.08 folder Only Session 8.1 and 8.2.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 4 BACKNEXTEND 4-1 LINKS TO OBJECTIVES Query Design Query Criteria Modify a Query Using OR.
1 Chapter 7 Query-By-Example by Monica Chan CS157B Professor Lee.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 6 – Designing.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Copyright 2008 McGraw-Hill Ryerson 1 TECHNOLOGY PLUG-IN T7 PROBLEM SOLVING USING ACCESS.
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
Tutorial 9 Using Action Queries and Advanced Table Relationships.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Database Applications – Microsoft Access Lesson 4 Working with Queries 36 Slides in Presentation.
O FFICE M ANAGEMENT T OOL - II B BA -V I TH. Abdus Salam2 Week-7 Introduction to Query Introduction to Query Querying from Multiple Tables Querying from.
T7-1 LEARNING OUTCOMES – ACCESS PROBLEM SOLVING 1.Describe the process of using the Simple Query Wizard using Access 2.Describe the process of using the.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 4 – Finding and Ordering Data.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 5 1 Microsoft Office Access 2003 Tutorial 5 – Enhancing a Table’s Design.
Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
Lesson 4: Querying a Database. 2 Learning Objectives After studying this lesson, you will be able to:  Create, save, and run select queries  Set query.
Creating Advanced Queries and Enhancing Table Design.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 4 1 Microsoft Office Access 2003 Tutorial 4 – Creating Forms and Reports.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Access Tutorial 2 Building a Database and Defining Table Relationships
Microsoft Office Access 2010 Lab 3
Maintaining a Database Using the Design and Update Features of Access
Access Tutorial 3 Maintaining and Querying a Database
Access Chapter 2 Querying a Database.
Microsoft Access – Tutorial 3
Objectives Query for top values Create a parameter query
Microsoft Office Access 2003
Plug-In T7: Problem Solving Using Access 2007
Objectives Create an action query to create a table
Microsoft Access 2003 Illustrated Complete
Microsoft Access 2003 Illustrated Complete
Building and Using Queries
Exploring Microsoft Office Access 2010
Microsoft Office Access 2003
Tutorial 1 – Introduction To Microsoft Access 2003
Creating and Modifying Queries
Tutorial 3 – Querying a Database
Tutorial 1 – Introduction To Microsoft Access 2003
Chapter 9 Lesson 2 Notes.
Microsoft Office Access 2003
Microsoft Office Access 2003
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Microsoft Office Access 2003
Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
Tutorial 7 – Integrating Access With the Web and With Other Programs
Tutorial 9 Using Action Queries and Advanced Table Relationships
Presentation transcript:

New Perspectives on Microsoft Microsoft Access 2002 Tutorial 8 – Using Query Wizards and Action Queries, and Defining Table Relationships New Perspectives on Microsoft Access 2002 Tutorial 8

Create a crosstab query A crosstab query performs aggregate function (arithmetic operations) calculations on the values of one database field and displays the results in a spreadsheet format. There are a variety of functions that can be used in crosstab queries including average, count, first field value, last field value, etc. Excel provides a Crosstab Query Wizard that will walk you through the creation of the crosstab query. New Perspectives on Microsoft Access 2002 Tutorial 8

Crosstab query aggregate functions The figure below shows the aggregate functions that can be used in a crosstab query. New Perspectives on Microsoft Access 2002 Tutorial 8

A select query versus a crosstab query This figure shows a Select query and a crosstab query. These two queries are based on the same data. In this case the crosstab query is using the Sum function to summarize the potential income for each country. However, notice that the crosstab query data is much more summarized than the select query data. New Perspectives on Microsoft Access 2002 Tutorial 8

The Crosstab Query Wizard steps First: select the table or query upon which you want to create the crosstab query. Second: select the fields that will be used for the row headings. Third: select the field that will be used for the column headings. Fourth: select the field that will be calculated upon and what calculation is to be performed. In the list of queries, crosstab queries will have a special icon that will identify them as such. New Perspectives on Microsoft Access 2002 Tutorial 8

The final Crosstab Query Wizard dialog box This figure shows the final Crosstab Query Wizard dialog box where you select the field to be used for the calculation, and which type of calculation to perform. New Perspectives on Microsoft Access 2002 Tutorial 8

Create a find duplicates query A find duplicates query is a select query that locates duplicate records in a table or query. The Find Duplicates Wizard will help you make selections about the field(s) for which you want to find duplicates. Use this type of query to locate duplicates that create potential problems in your database, such as assigning two different product numbers to the same product. New Perspectives on Microsoft Access 2002 Tutorial 8

A sample find duplicates query datasheet The following figure shows a “find duplicates” query datasheet. Notice that this datasheet includes records for employers that have multiple positions available (i.e., the employer appears more than once in the underlying table). New Perspectives on Microsoft Access 2002 Tutorial 8

Create a find unmatched query You can also create a find unmatched query, which returns a datasheet for all records that do not have a matching record in the related table. This figure shows the third dialog box of the Unmatched Query Wizard. Notice that on this dialog box, you will select which fields in each table for which you are checking for unmatched records. New Perspectives on Microsoft Access 2002 Tutorial 8

Create a top values query You can use the Top Values query to display a specified number of records. Specify a number indicating the number of records to display or specify a percentage indicating the percentage of the records to display. For example, you could specify 20 percent, which would produce a resulting a datasheet displaying only 20 percent of the records The Top Values button on the query design toolbar will allow you to select from a list or to enter your own value for the Top Values query. New Perspectives on Microsoft Access 2002 Tutorial 8

Setting the top value query value In the figure below, you can see that the Top Values list box has been set to 25 percent. This means that the resulting query will display the highest 25 percent of potential income amounts. New Perspectives on Microsoft Access 2002 Tutorial 8

The top value query datasheet The following figure is the result of the query design shown in the preceding figure. New Perspectives on Microsoft Access 2002 Tutorial 8

New Perspectives on Microsoft Create action queries You can create other types of queries that make changes to the data in the underlying table(s). Action queries can: Create a new table (make-table query) Add records to a table (append query) Delete records from a table (delete query) Update the data in a table (update query) New Perspectives on Microsoft Access 2002 Tutorial 8

Action query considerations When creating a query that actually makes changes to your database, take extreme care that you do not create a query that performs unintended actions. It is a good idea to create your action query first as a select query. You can then view the results and determine if these are the records you want to alter. When you are sure the query will be applied to the records you really want, you can then run the query as an action query. New Perspectives on Microsoft Access 2002 Tutorial 8

Use make-table and append query queries To change a select query to a Make Table query, choose Make-Table Query from the Query Type button's list. This will open the Make Table dialog box, in which you will specify the name of the new table. To change a select query to an append query, choose Append Query from the Query type button's list. In the Append Query dialog box, you will specify to which table you want to append records. The Append To row will be displayed in the design grid indicating the fields that the query will append to the table. New Perspectives on Microsoft Access 2002 Tutorial 8

The Make Table dialog box The Make Table dialog box is used to create a make table query, which creates a new table from an existing table. New Perspectives on Microsoft Access 2002 Tutorial 8

The query window for an append query This figure shows the query window for an append query. The Append To row shows the fields that the query will append to the specified table. New Perspectives on Microsoft Access 2002 Tutorial 8

Apply an advanced filter in a table You can create advance filters that allow you to specify multiple selection criteria and to specify a sort order for the selected records. The Advance Filter window looks very similar to a query design window and works in a similar manner. You add the fields to the design grid for which you want to specify selection criteria and/or sorting specifications. Once you have added the criteria you want for your filter, you can apply the filter by pressing the Apply Filter button. You can also remove the filter by pressing the Remove Filter button. New Perspectives on Microsoft Access 2002 Tutorial 8

New Perspectives on Microsoft The Filter window In the Filter window, you select only the fields that will be involved in the filtering and sorting specifications. The Filter window works very much like the query design grid. You can specify filtering and sorting criteria for the Advanced Filter. New Perspectives on Microsoft Access 2002 Tutorial 8

Define many-to-many and one-to-one relationships between tables A many-to-many relationship exists between tables when the tables involved have multiple matches in each of the tables. For example, if you have a table containing student data and another table containing course data, you could say that this is a (M:N) relationship because a student can take many courses and a course can have many students Whenever there is a many-to-many relationship, you must provide a third table that will “link” the two tables together in a one-to-many relationship. You can also have a one-to-one relationship between tables, which means that there is exactly one record in the primary table that matches exactly one record in the related table. New Perspectives on Microsoft Access 2002 Tutorial 8

A many-to-many relationship In the figure below, you see an illustration of a many-to-many relationship. Note that the Job table is used to join the Position table and the Student table. The Job table contains a PositionID and a StudentID for each position that a students holds. In this case, a student can have more than one position and a position can be held by more than one student. New Perspectives on Microsoft Access 2002 Tutorial 8

A query datasheet for a many-to-many relationship Once you have created the third table (the table that joins the two tables in a many-to-many relationship) you can create a query based on all three tables. The following figure show a query datasheet based on the three tables. New Perspectives on Microsoft Access 2002 Tutorial 8

View and create indexes to tables When you establish a primary key for a table, you are actually creating an index for the table. An index is a list that relates field values to the records that contain those field values. The index makes it faster to search for records and to sort the records in a table. You can view existing indexes in table design view by clicking on the Indexes button on the Table Design toolbar. New Perspectives on Microsoft Access 2002 Tutorial 8

New Perspectives on Microsoft How indexing works You can create an index on any field in a table. However, each index actually is a new file and takes up space When records are entered into a table they are assigned an internal record number in the order they were entered. The index created a different ordering of the records but keeps track of the number originally assigned to the record. New Perspectives on Microsoft Access 2002 Tutorial 8

An illustration of an index In the figure below, you can see a graphical representation of the use of an index in the Position table. In this example, the index on the PositionID field (primary key) is in ascending order and an additional field, the Record Number field, maintains the assigned record number. New Perspectives on Microsoft Access 2002 Tutorial 8

New Perspectives on Microsoft The Indexes window This figure shows the Indexes window, which can be used to view index information. New Perspectives on Microsoft Access 2002 Tutorial 8

Join a table using a self-join There are three types of joins: The inner join selects records from two tables only when the records have the same value in the common field that links the tables. A left outer join selects all records from the first, or left, table and only those records from the second, or right, table that have matching common field values. A right outer join selects all records from the second, or right, table and only those records from the first, or left, table that have matching common field values. A self-join can be either an inner or outer join and is used to join a table to itself. New Perspectives on Microsoft Access 2002 Tutorial 8

An example of an inner join In this figure you see an example of an inner join. Notice that the resulting datasheet includes only those records that have matching StudentID fields in the two tables. New Perspectives on Microsoft Access 2002 Tutorial 8

An example of a left outer join The next figure shows an example of a left outer join. Notice that the resulting datasheet includes all the records from the Student table and only those records from the Job table that have a matching record in the Student table. New Perspectives on Microsoft Access 2002 Tutorial 8

An example of a right outer join This figure is an example of a right outer join. In this case, the resulting datasheet contains all the records from the Job table and only those records from the Student table that have a matching record in the Job table. New Perspectives on Microsoft Access 2002 Tutorial 8

An example of a self-join This figure shows the datasheet for a self-join. New Perspectives on Microsoft Access 2002 Tutorial 8