Referential Integrity

Slides:



Advertisements
Similar presentations
Table Relationships RDBM. Prof. Leighton2 Establishing Table Relationships RDBMS allow us to establish relationships among tables Have a primary key in.
Advertisements

Exploring Microsoft Access 2003 Chapter 5 One-to-Many Relationships : Subforms and Multiple Table Queries.
Relationships Relational Database. Identifying Entities… In the previous tutorial you learnt about identifying entities in a flat file database. Also.
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.
Exploring Microsoft Access 2003 Chapter 6 Many-to-Many Relationships: A More Complex System.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 1 Committed to Shaping the Next Generation of IT Experts. Chapter 2: Relational Databases.
ISP 121 Access Normalization and Relationships. Normalization Say we’re operating a pet day-care and we need to keep information on our pets/customers.
Maintenance Modifying the data –Add records –Delete records –Update records Modifying the design –Add fields into tables –Remove fields from a table –Change.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
RELATIONSHIP  THE WAY TABLES ARE RELATED  A TABLE MUST PARTICIPATE IN AT LEAST ONE RELATIONSHIP  IN A BINARY RELATIONSHIP TWO ENTITIES PARTICIPATE 
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Microsoft Access II Information Technology Services User Services User Training & Support.
Computer Science & Engineering 2111 Introduction to Database Management Systems Relationships and Database Creation 1 CSE 2111 Introduction to Database.
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.
ACCESS CHAPTER 1. OBJECTIVES Tables Queries Forms Reports Primary and Foreign Keys Relationship.
Microsoft Access Lesson 3
Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 1. Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office.
1 Microsoft Access 2002 Tutorial 3 – Querying a Database.
Access Lesson 2 Creating a Database
With Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Office 2007 Intermediate.
With Microsoft Access 2007 Volume 1© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! with Microsoft ® Access 2007 Volume 1 Chapter.
Primary & Foreign Keys. PK & FK 1.Primary key is required 2.The PK must be unique 3.If the primary key from one table is related to a field in another.
DAY 15: ACCESS CHAPTER 2 Larry Reaves October 7,
CS&E 1111 AcInnerJoins Inner Joins Objectives: Creating Queries with data from Multiple Tables Joining two tables using an Inner Join Referential Data.
Learningcomputer.com SQL Server 2008 – Entity Relationships in a Database.
® Microsoft Office 2013 Access Building a Database and Defining Table Relationships.
® 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.
© 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 9 – Building Links,
BTEC National Extended Diploma1 IT Systems Analysis and Design Entity Relationship Diagrams.
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.
Relationships and Advanced Query Concepts Using Multiple Tables Please use speaker notes for additional information!
DAY 12: DATABASE CONCEPT Tazin Afrin September 26,
Database Design. Referential Integrity : data in a table that links to data in another table must always work in such a way that following the link will.
® Microsoft Office 2010 Building a Database and Defining Table Relationships.
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
Microsoft Access Intro Class 6 Relationships.
Using Microsoft Access 56:150 Information System Design.
INFO1408 Database Design Concepts Week 15: Introduction to Database Management Systems.
Microsoft Access 2013 Design and Implement Powerful Relational Databases Chapter 6.
Database collection of related information stored in an organized form Database program software tool for storage & retrieval of that information.
Exploring Microsoft Access Chapter 6 Many-to-Many Relationships: A More Complex System.
Microsoft Access 2013 ®® Tutorial 9 Using Action Queries and Advanced Table Relationships.
1 Database Systems Introduction to Microsoft Access Part 2.
Microsoft Access 2010 Chapter 3 Maintaining a Database.
Rebecca McCready Faculty of Medical Sciences Newcastle University Lecture 2 – Relationships and Lookup fields.
3. Relational Model Lingma Acheson Department of Computer and Information Science IUPUI CSCI N207 Data Analysis with Spreadsheets 1.
U:/msu/course/cse/103 Day 18, Slide 1 CSE 103 Day 18 If you are not enrolled in CSE 103, please save and log out by 10:10.
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.
Exploring Office Grauer and Barber 1 One-to-Many Relationships: Subforms and Multiple-Table Queries(Wk7)
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
D1 FMA Review. Many-to-Many Relationships - Examples Car Hire –A customer may hire one or more cars –A car may be hired by one or more customers Gym Club.
MSOffice Access Microsoft® Office 2010: Illustrated Introductory 1 Part 1 ® Database & Table.
Exploring Microsoft Access Chapter 5 One-to-Many Relationships: Subforms and Multiple Table Queries.
Review Types of Relationship – there are in general three different types of relationships - One to One – where each record in one table can have not more.
Chapter 6 Many-to Many Relationship. Agenda AutoNumber Many-to-many relationship Cascaded updating and deleting Auto Lookup Parameter query Total query.
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
XP Chapter 1 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Level 2 Objectives: Understanding and Creating Table.
Copyright © 2014 Pearson Canada Inc. Ext. 5b-1 Copyright © 2014 Pearson Canada Inc. Application Extension 5b Using Microsoft Access Part 2: Using Information.
AOIT Database Design Unit 3, Lesson 9 Data Integrity Copyright © 2009–2011 National Academy Foundation. All rights reserved.
Tables & Relationships
Microsoft Access 2016 Design and Implement Powerful Relational Databases Chapter 6.
CIS 155 Table Relationship
Database Relationships
Design and Implement Powerful Relational Databases Chapter 6
Relational Queries (query 12) Display vendor contact info (contact person and phone number) for inventory products (relationship query) Query: Inventory.
Microsoft Access Validation Rules, Table Relationships And
Relationships While we are on the subject of Relationships, let’s take a quick look at them.
Presentation transcript:

Referential Integrity How referential integrity works Cascade Update and Delete

Referential Integrity Referential integrity controls the links between records You can set referential integrity when related fields have the same data type (an AutoNumber field can be related to a Number field).

How referential integrity works You can't enter a value in the foreign key field of a table if it doesn't exist in the primary key of the related table For example, you can't assign an order to a customer who is not in the Customer table You can't delete a record from a table if matching records exist in a related table For example, you can't delete an employee if there are orders assigned to the employee in the Order table

How referential integrity works (2) You can't change a primary key value for a record that has related records For example, you can't change an employee's ID in the Employee table if there are orders assigned to that employee in the Orders table.

Cascade Update and Delete For relationships with referential integrity enforced, you can say whether you want Microsoft Access to automatically cascade update and cascade delete related records When you try to delete records or update linked primary key values, Microsoft Access changes the related tables to allow your updates to go ahead, preserving referential integrity

Cascade Update and Delete (2) Example of cascade update: if you change a customer's ID in the Customer table, the CustomerID field in the Orders table is automatically updated for that customer's orders so that the relationship isn't broken Microsoft Access cascades updates without displaying any message.

LETS DISCUSS THIS FURTHER Order Products Employee Product OrderID ProductID Qty 1 A1 A2 15 A3 23 2 12 EmployeeID Employee Name 100 John Smith 101 Mia Lee ProductID ProductName A1 Football A2 Tennis Ball A3 Golf Clubs Customer CustID Cust Name C1 Gianni Albin C2 Martin Jones Order table OrderID EmployeeID CustID OrderDate Deliver_by Comments 1 100 C1 29/03/2009 29/04/2009 Ring the bell 2 101 C2 16/04/2009 17/04/2009 N/A Your Lecturer will now give you some examples of Referential integrity and Cascade update/delete. BTEC National Extended Diploma