One Customer has Many Pets; One Pet as One Customer, so Customer ID goes on Pet Table. One Pet has many Visits, but only one Visit refers.

Slides:



Advertisements
Similar presentations
Data Design The futureERD - CardinalityCODINGRelationshipsDefinition.
Advertisements

Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Concepts of Database Management Sixth Edition
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.
SUNY Morrisville-Norwich Campus-Week 10 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
The Relational Database Model
The Relational Database Model. 2 Objectives How relational database model takes a logical view of data Understand how the relational model’s basic components.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Lesson 32: Designing a Relational Database. 2 Lesson Objectives After studying this lesson, you will be able to:  Identify and apply principles for good.
MIS2502: Data Analytics Relational Data Modeling
Mapping ERM to relational database
Database Design.  Define a table for each entity  Give the table the same name as the entity  Make the primary key the same as the identifier of the.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
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,
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
Instructor: Craig Duckett Lecture 04: Thursday, October 8 th, 2015 Relationships 1 BIT275: Database Design (Fall 2015)
PLUG IT IN 3 Fundamentals of Relational Database Operations.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 9 1 Microsoft Office Access 2003 Tutorial 9 – Using Action Queries, and Defining Table Relationships.
Databases. Not All Tables Are Created Equal Spreadsheets use tables to store data and formulas associated with that data The “meaning” of data is implicit.
1 Outline  What is a Primary Key?  AutoNumber primary keys  Single-field primary keys  Composite-field primary key  About Foreign Keys  Database.
M1G Introduction to Database Development 2. Creating a Database.
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.
® Microsoft Access 2010 Tutorial 9 Using Action Queries and Advanced Table Relationships.
Joins We will look at joins again this time we will closer examine each join type in detail. We will look at the following join types. a)inner join b)Right.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Physical.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
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 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Pasewark & Pasewark 1 Access Lesson 3 Creating Queries Microsoft Office 2007: Introductory.
Database revision.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
An Entity Relationship (ER) Diagram is a graphic that shows the interrelationship between entities in a database.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
Database Systems, 9th Edition 1.  In this chapter, students will learn: That the relational database model offers a logical view of data About the relational.
3 1 Chapter 3 The Relational Database Model Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
ENTITY RELATIONSHIP DIAGRAM ENTITY RELATIONSHIP DIAGRAM IS A SPECIALIZED GRAPHIC THAT ILLUSTRATES THE INTERRELATIONSHIPS BETWEEN ENTITIES IN A DATABASE.
File and Database Design Class 22. File and database design: 1. Choosing the storage format for each attribute from the logical data model. 2. Grouping.
SQL LANGUAGE and Relational Data Model TUTORIAL Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 3 The Relational Database Model.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 3 The Relational Database Model.
Lesson 2: Designing a Database and Creating Tables.
CSC 240 (Blum)1 Introduction to Access CSC 240 (Blum)2 Click on the Access desktop icon or go to Start/All Programs/Microsoft Office/Microsoft Office.
Department of Mathematics Computer and Information Science1 CS 351: Database Systems Christopher I. G. Lanclos Chapter 3: The Relational Database Model.
MIS2502: Data Analytics Relational Data Modeling
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Connecting (relating) Data Tables to get Custom Records (Queries) Database Basics.
MIS2502: Data Analytics Relational Data Modeling David Schuff
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
Chapter 3 The Relational Database Model. Database Systems, 10th Edition 2 * Relational model * View data logically rather than physically * Table * Structural.
CHAPTER 2 : RELATIONAL DATA MODEL Prepared by : nbs.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 3 The Relational Database Model.
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.
Teanna Clarke 6aQ What is a Entity-Relationship Diagram?  An Entity-Relationship Diagram (ERD) is a tool that graphically shows the connections among.
Data Modeling AND ER MODELS.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data.
AOIT Database Design Unit 3, Lesson 9 Data Integrity Copyright © 2009–2011 National Academy Foundation. All rights reserved.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Relational Model Characteristics
DATABASE SYSTEM.
Database Systems: Design, Implementation, and Management
Presentation transcript:

One Customer has Many Pets; One Pet as One Customer, so Customer ID goes on Pet Table. One Pet has many Visits, but only one Visit refers to one Pet, so ONE’s ID goes on MANY’s Table. PetID goes on Visit Table.

One VISIT Can have MANY Procedures; the table as shown above limits the visit to having three. That would be OK—until you need more. If this refers to a specific procedure which could be described by another table, it is a one-to-many relationship and can have the VisitID as Foreign Key on the Procedure Table. No FK here CustID as FK PetID As FK VisitID as FK

Does CustomerNumber belong on the Product Table? NO

It was not on the Product Table. Note the Order Detail Table with TWO Primary Keys. When one ORDER could have many PRODUCTS and one PRODUCT can be on many Orders, this is a Many-to-Many Relationship.

Note the Order Detail Table with TWO Primary Keys. When one ORDER (ORDER TABLE) could have many PRODUCTS and one PRODUCT (PRODUCT TABLE) can be on many Orders, this is a Many-to-Many Relationship.

Join Types Type 1 Join – INNER JOIN Type 2 – LEFT OUTER JOIN Type 3 – RIGHT OUTER JOIN ABDEFHABDEFH BCDEFGBCDEFG ABDEFHABDEFH BCDEFGBCDEFG ABDEFHABDEFH BCDEFGBCDEFG RESULTS of these JOINS BDEFBDEF ABDEFHABDEFH BCDEFGBCDEFG Only fields where both tables match All fields of left table and only matching fields from right table All fields of right table and only matching fields from left table

Join Types from Chapter 9 Type 1 Join – INNER JOIN Type 2 – LEFT OUTER JOIN Type 3 – RIGHT OUTER JOIN ABDEFHABDEFH BCDEFGBCDEFG ABDEFHABDEFH BCDEFGBCDEFG ABDEFHABDEFH BCDEFGBCDEFG RESULTS of these JOINS BDEFBDEF ABDEFHABDEFH BCDEFGBCDEFG Only fields where both tables match All fields of left table and only matching fields from right table All fields of right table and only matching fields from left table

One-to-One Relationships exist when ONE item from the Primary Table will match only ONE item on the Secondary Table and ONE item in the Secondary Table will match only ONE item in the Primary Table. An example is Business Address and Mailing Address. One business will have mail either go to that same address (actual physical location is used for mailing) or sometimes to another address, such as a P. O. Box. This can be “handled” by a One-to-One relationship called an Entity Subtype. We’ll learn how to choose one rather than the other later by using Conditional IIF Statements. However, if you leave the default join type, INNER JOIN, you won’t have much data! Using this (where not all businesses use a P. O. Box for mail) requires us to use an Outer Join. If we have 100 businesses and only 20 of them have entries in this one- to-one relationship table and we have an “INNER JOIN,” which is what you get if you don’t SPECIFY it yourself, you’ll only see 20 businesses in your results! If you only mail out your flyers to that group, you have lost a lot of business! One-to-One Relationships

One-to-One Lookup One-to-Many Many-to-Many Details table with composite key Relationships

What do we need to do.doc