Tutorial 9 Using Action Queries and Advanced Table Relationships.

Slides:



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

Concepts of Database Management Seventh Edition
Access Lesson 2 Creating a Database
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
Access Tutorial 3 Maintaining and Querying a Database
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 1 Creating a Database
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
Querying a Database Microsoft Office Access 2003.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 3 Maintaining a Database Using the Design and Update Features of Access.
Access Tutorial 10 Automating Tasks with Macros
Tutorial 1 Creating a Database. Objectives Learn basic database concepts and terms Learn basic database concepts and terms Explore the Microsoft Access.
Chapter 2 Querying a Database
FIRST COURSE Integration Tutorial 3 Integrating Word, Excel, Access, and PowerPoint.
Chapter 3 Maintaining a Database
Maintaining and Querying a Database Microsoft Access 2010.
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,
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 1Advanced Tables, Relationships, Queries, and Forms Chapter 3Advanced Query Techniques.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Chapter 2 Querying a Database MICROSOFT ACCESS 2010.
Tutorial 8 Advanced Queries. Notes Switch to new database! Tutorial.08 folder Only Session 8.1 and 8.2.
Access Tutorial 2 Building a Database and Defining Table Relationships
Chapter 6 Advanced Report Techniques
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
Microsoft Access 2003 Define some key Access terminology: Field – A single characteristic or attribute of a person, place, object, event, or idea. Record.
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
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.
MS-ACCESS BY SANGEETHA PARTHASARATHY Topics to be covered §Comparing Values in Selection Criteria §Calculating Values in a Query §Changing the appearance.
FIRST COURSE Access Tutorial 4 Creating Forms and Reports.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
® Microsoft Access 2010 Tutorial 2 Building a Database and Defining Table Relationships.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Microsoft Office 2007 Access Chapter 3 Maintaining a Database.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Office 2013 Access Creating a Database.
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 2 BACKNEXTEND 2-1 LINKS TO OBJECTIVES Creating Related Tables Creating Related Tables Determining.
Microsoft Access 2013 ®® Tutorial 9 Using Action Queries and Advanced Table Relationships.
COMPREHENSIVE Access Tutorial 3 Maintaining and Querying a Database.
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.
Actions Queries. Understanding Action Queries  Action queries are a way to make corrections to database. They can make an enormous mess of database if.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Access Project 1 Creating and Using a Database.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
1 CHƯƠNG 4 Creating Relational Databases Understanding Table Relationships Example: This database tracks customers and their orders in two separate.
XP New Perspectives on Microsoft Access 2002 Tutorial 31 Microsoft Access 2002 Tutorial 3 – Querying a Database.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
COMPREHENSIVE Access Tutorial 1 Creating a Database.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Access Tutorial 2 Building a Database and Defining Table Relationships
Tutorial 1 Creating a Database
Objectives Create an action query to create a table
Access Creating a Database
Microsoft Access 2003 Illustrated Complete
Access Creating a Database
Access Tutorial 4 Creating Forms and Reports
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 4 Creating Forms and Reports
Tutorial 9 Using Action Queries and Advanced Table Relationships
New Perspectives on Microsoft
Presentation transcript:

Tutorial 9 Using Action Queries and Advanced Table Relationships

Objectives Create an action query to create a table Create action queries to append, delete, and update data Define many-to-many and one-to-one relationships between tables Learn about joining tables Join a table using a self-join View and create indexes for tables New Perspectives on Microsoft Access 20102

Action Queries New Perspectives on Microsoft Access 20103

Action Queries An action query is a query that adds, changes, or deletes multiple table records at a time – Make-table query – Append query History table – Delete query – Update query New Perspectives on Microsoft Access 20104

Creating a Make-Table Query Create a select query with the necessary fields and selection criteria In the Results group on the Design tab, click the Run button to preview the results Switch to Design view to make any necessary changes to the query. When the query is correct, click the Make Table button in the Query Type group on the Design tab New Perspectives on Microsoft Access 20105

Creating a Make-Table Query In the Make Table dialog box, type the new table name in the Table Name box. Make sure the Current Database option button is selected to include the new table in the current database; or, click the Another Database option button and enter the database name in the File Name box. Then click the OK button Click the Run button, and then click the Yes button to confirm the creation of the new table New Perspectives on Microsoft Access 20106

Creating a Make-Table Query New Perspectives on Microsoft Access 20107

Creating an Append Query Create a select query with the necessary fields and selection criteria In the Results group on the Design tab, click the Run button to preview the results Switch to Design view to make any necessary changes to the query. When the query is correct, click the Append button in the Query Type group on the Design tab New Perspectives on Microsoft Access 20108

Creating an Append Query In the Append dialog box, select the table name in the Table Name box. Make sure the Current Database option button is selected to include the new table in the current database; or, click the Another Database option button and enter the database name in the File Name box. Then click the OK button. Access replaces the Show row in the design grid with the Append To row Click the Run button, and then click the Yes button to confirm appending the records to the table New Perspectives on Microsoft Access 20109

Creating an Append Query New Perspectives on Microsoft Access

Creating a Delete Query Create a select query with the necessary fields and selection criteria In the Results group on the Design tab, click the Run button to preview the results Switch to Design view to make any necessary changes to the query. When the query is correct, click the Delete button in the Query Type group on the Design tab. Access replaces the Show and Sort rows in the design grid with the Delete row Click the Run button, and then click the Yes button to confirm deleting the records New Perspectives on Microsoft Access

Creating a Delete Query New Perspectives on Microsoft Access

Creating an Update Query Create a select query with the necessary fields and selection criteria In the Results group on the Design tab, click the Run button to preview the results Switch to Design view to make any necessary changes to the query. When the query is correct, click the Update button in the Query Type group on the Design tab. Access replaces the Show and Sort rows in the design grid with the Update To row New Perspectives on Microsoft Access

Creating an Update Query Type the updated values in the Update To boxes for the fields you want to update Click the Run button, and then click the Yes button to confirm changing the records New Perspectives on Microsoft Access

Many-To-Many Relationship New Perspectives on Microsoft Access

Relationships Between Database Tables New Perspectives on Microsoft Access

Relationships Between Database Tables New Perspectives on Microsoft Access

Defining M:N and 1:1 Relationships Between Tables New Perspectives on Microsoft Access

Make an Alias Right Click on the table name in the Query Window then Click on Properties. Change the name of the table from Property Sheet. New Perspectives on Microsoft Access

Make an Alias New Perspectives on Microsoft Access

Joining Tables JOIN can combine two tables. JOIN Type: – Inner Join -- fields exist in both tables – Left Outer Join -- all rows in left table with values from right table where they match – Right Outer Join -- all rows in right table with values from the left table where they match – Self Join, Joining two fields in one tables. New Perspectives on Microsoft Access

09/11/12.22 JOIN illustration ID,AGE 1,42 2,19 3,17 ID,NAME 1,JONES 3,SMITH 5,BUSTER

09/11/12.23 Inner JOIN ID,AGE 1,42 2,19 3,17 1, 42, JONES 3, 17, SMITH 1, 1, 42, JONES 3, 3, 17, SMITH ID,NAME 1,JONES 3,SMITH 5,BUSTER

09/11/12.24 Left Outer JOIN ID,AGE 1,42 2,19 3,17 1, 42, JONES 2, 19, null 3, 17, SMITH ID,NAME 1,JONES 3,SMITH 5,BUSTER

09/11/12.25 Right Outer JOIN ID,AGE 1,42 2,19 3,17 1, 42, JONES 3, 17, SMITH 5, null, BUSTER ID,AGE 1,42 2,19 3,17 ID,NAME 1,JONES 3,SMITH 5,BUSTER

Joining Tables In the Query Design Window, Insert the tables then right click on the relationship, Click on “Join Properties”. New Perspectives on Microsoft Access

Joining Tables New Perspectives on Microsoft Access

Joining Tables New Perspectives on Microsoft Access

Joining Tables An inner join is a join in which the DBMS selects records from two tables only when the records have the same value in the common field that links the tables New Perspectives on Microsoft Access

Joining Tables An outer join is a join in which the DBMS selects all records from one table and only those records from a second table that have matching common field values New Perspectives on Microsoft Access

Creating a Self-Join Click the Create tab on the Ribbon In the Queries group on the Create tab, click the Query Design button In the Show Table dialog box, double-click the table for the self-join, double-click the table a second time, and then click the Close button Click and drag the primary key field from one field list to the foreign key field in the other field list New Perspectives on Microsoft Access

Creating a Self-Join Right-click the join line between the two tables, and then click Join Properties to open the Join Properties dialog box Click the first option button to select an inner join, or click the second option button or the third option button to select an outer join, and then click the OK button Select the fields, specify the selection criteria, select the sort options, and set other properties as appropriate for the query New Perspectives on Microsoft Access

Creating a Self-Join New Perspectives on Microsoft Access

Viewing a Table’s Existing Indexes Open the table in Design view To view an index for a single field, click the field, and then view the Indexed property in the Field Properties pane To view all the indexes for a table or to view an index consisting of multiple fields, click the Indexes button in the Show/Hide group on the Design tab New Perspectives on Microsoft Access

Viewing a Table’s Existing Indexes New Perspectives on Microsoft Access

Creating an Index Open the table in Design view To create an index for a single field, click the field, and then set the Indexed property in the Field Properties pane To create an index consisting of multiple fields, click the Indexes button in the Show/Hide group on the Design tab, enter a name for the index in the Index Name box, select the fields in the Field Name box, and then set other properties as necessary for the index New Perspectives on Microsoft Access

Creating an Index New Perspectives on Microsoft Access