Relationships While we are on the subject of Relationships, let’s take a quick look at them.

Slides:



Advertisements
Similar presentations
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Advertisements

McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module J (Office 2010 Version) Implementing.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module J (Office 2010 Version) Implementing.
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
Access Lesson 2 Creating a Database
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 3 1 Microsoft Office Access 2003 Tutorial 3 – Querying a Database.
Extended Learning Module J (Office 2007 Version) Implementing a Database with Microsoft Access McGraw-Hill/Irwin Copyright © 2010 by the McGraw-Hill Companies,
COMPREHENSIVE Access Tutorial 2 Building a Database and Defining Table Relationships.
Querying a Database Microsoft Office Access 2003.
FIRST COURSE Access Tutorial 2 Building a Database and Defining Table Relationships.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Define Table Relationships—1 of 3 One of the most powerful features of a relational database management system, such as Access, is its ability to define.
Chapter 3 Maintaining a Database
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Microsoft Access – Tutorial 3
Viewing Tip: While viewing this presentation in your browser, select Browse, Full Screen. Then, when you want to pause the show, Right Click and select.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
McGraw-Hill/Irwin ©2009 The McGraw-Hill Companies, All Rights Reserved Business Driven Information Systems 2e Plug-In T6: Basic Skills and Tools Using.
® Microsoft Office 2010 Access Tutorial 2 Building a Database and Defining Table Relationships.
Office Management Tools II Ms Saima Gul.  When you create your tables, you should assign each table a primary key—one or more fields whose contents are.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 2 1 Microsoft Office Access 2003 Tutorial 2 – Creating And Maintaining A.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
McGraw-Hill/Irwin © 2008 The McGraw-Hill Companies, All Rights Reserved Plug-In T6: Basic Skills and Tools Using Access 2010 Business Driven Technology.
Microsoft Access Intro Class 6 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.
1 After completing this lesson, you will be able to: Change the format of a table. Sort records in a table. Find records in a table Use filters with a.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T6 Basic Skills Using Access.
1 Database Systems Introduction to Microsoft Access Part 2.
McGraw-Hill/Irwin ©2005 The McGraw-Hill Companies, All rights reserved ©2005 The McGraw-Hill Companies, All rights reserved McGraw-Hill/Irwin.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. Adding a new field 1Right click the table name and select design view 2Type the field information at the end.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
You can sort Access data so you can view records in the order you want to view them, and you can filter data so you only see the records you want to see.
Microsoft Office 2013: In Practice Chapter 2 Using Design View, Data Validation, and Relationships Copyright © 2014 by The McGraw-Hill Companies, Inc.
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.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
McGraw-Hill/Irwin Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. Extended Learning Module J (Office 2007 Version) Implementing.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
Homework 4 Hints. Chapter 6 Guided Exercise Make sure to enforce Referential Integrity and Cascade Update when prompted Step 4 – Make sure to add a record.
Access Module Implementing a Database with Microsoft Access A Great Module on Your CD.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
Access Tutorial 2 Building a Database and Defining Table Relationships
Tutorial 1 Creating a Database
Using Macros, Switchboards, PivotTables, and PivotCharts
Microsoft Access 2016 Design and Implement Powerful Relational Databases Chapter 6.
Access Tutorial 1 Creating a Database
Practical Office 2007 Chapter 10
Microsoft Access – Tutorial 3
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Access Creating a Database
Microsoft Office Illustrated Fundamentals
Access Creating a Database
Access Lesson 1 Understanding Access Fundamentals
Microsoft Office Access 2003
Access Tutorial 1 Creating a Database
Tutorial 3 – Querying a Database
Access Lesson 2 Creating a Database
Microsoft Office Access 2003
Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory.
Microsoft Official Academic Course, Access 2016
Microsoft Office Access 2003
Access Tutorial 2 Building a Database and Defining Table Relationships
Access Tutorial 2 Building a Database and Defining Table Relationships
Grauer and Barber Series Microsoft Access Chapter One
Access Lesson 1 Microsoft Access Basics
New Perspectives on Microsoft
Presentation transcript:

Relationships While we are on the subject of Relationships, let’s take a quick look at them.

Relationships Remember or example about the customer and order tables? One Customer, hopefully many orders?

In this example, we have two tables, the Customer table and the Orders table. The relationship between the two is a “One to Many” relationship because there is “One” record for each customer (no duplicate customers) in the Customer table and hopefully “Many” of the same Customer in the Orders table representing many orders from each customer. Customer Table Orders Table

“One” customer, hopefully “Many” orders is a “One-to-Many” relationship. Customer Table Orders Table

Relationships We can join the two tables together by joining the common field in the One Side, [Customer].[CustomerNum] to the common field in the Many Side, [ Order].[CustomerNum].

Relationships To do that, we start at the database window, select Tools from the Menu Bar and then select Relationships.

Relationships From the resulting “Relationships” window, we select Relationships, and Show Table ...

Relationships From the resulting “Show Table” window, we select Our “One Side” table (customers in this case), and then click “Add”.

Relationships We then select our “Many Side” table, (order in this case) and then again click “Add”.

Relationships Then, simply click the Close Button.

Relationships We will then be back to our Relationships window with the Customer and Order tables showing.

To create a relationship (join), click on the common field (CustomerNum) in the One Side (left side), hold the button down, and drag to the common field (CustomerNum) in the Many Side (Order Table) and release the button.

As soon as we release the mouse button on top of the CustomerNum field in the Order Table, the Edit Relationships window appears. This window first, gives us a chance to verify that we selected the correct fields and the ability to change them if we did not.

We then can “Enforce Referential Integrity” if we so desire by simply clicking in the “Enforce Referential Integrity” check box.

Just what is Referential Integrity? Simply put, using an example, if you have Referential Integrity enforced, when you enter a customer number in your order table, and that customer number does not exist in your customer table, Access will will give you a message saying that you can not enter that customer number as it does not exist in the customer table.

If we choose to “Enforce Referential Integrity” we then have two more options available to us, Cascade Update Related Fields and Cascade Delete Related Records.

If you select the Cascade Update Related Fields check box when defining a relationship, any time you change the primary key of a record in the primary table, Microsoft Access automatically updates the primary key to the new value in all related records. For example, if you change a customer's ID in the Customers table, the CustomerID field in the Orders table is automatically updated for every one of that customer's orders so that the relationship isn't broken. Microsoft Access cascades updates without displaying any message.

If you select the Cascade Delete Related Records check box when defining a relationship, any time you delete records in the primary table, Microsoft Access automatically deletes related records in the related table. For example, If you delete a customer record from the Customers table, all the customer's orders are automatically deleted from the Orders table (this includes records in the Order Details table related to the Orders records). When you delete records from a form or datasheet with the Cascade Delete Related Records check box selected, Microsoft Access warns you that related records may also be deleted.

However, when you delete records using a delete query, Microsoft Access automatically deletes the records in related tables without displaying a warning. We will be discussing delete queries in great detail in an upcoming class.

Notice Access automatically determines the Relationship type.

If you know that you have a one to many relationship, and this says you have a one-to-one relationship, check the fields above to make sure that you have selected the proper common field in both tables.

Relationships The final step is to click on the Create Button.

Relationships If we selected to “Enforce Referential Integrity” we will see a join line showing the one on the left and the infinity sign (many) on the right.

If we selected Not to “Enforce Referential Integrity” . . .

we will see a plain join line without the one on the left and the infinity sign (many) on the right.

Relationships The final step is to select File and then Save from the Relationships window.

Relationships and then select File and Close.