Lecture 3 Entity Relationship diagram (ERD) Cardinalities

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model (part I)
Advertisements

Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
IT420: Database Management and Organization
Entity-Relationship (E-R) modeling: constructing a conceptual schema (Chapter 5) Due to course constraints I have to defer other modeling issues (normalization.
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Entity Relationship Modeling BUS112 Professor Kwan.
Modeling Data The Entity Relationship Model (ER) For Database Design.
Data Modeling Entity - Relationship Models. Models Used to represent unstructured problems A model is a representation of reality Logical models  show.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Entity Relationship (E-R) Modeling
1 Data Modelling Which data to include in the database.
Chapter 3 Data Modeling Fundamentals of Database Management Systems by
Things are bad. Children no longer obey their parents and everyone is writing a book. -- Marcus Tillius Cicero.
Entity Relationship Model Chapter 6. Basic Elements of E-R Model Entity Object of the real world that stores data. Eg. Customer, State, Project, Supplier,
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Entity-Relationship Modeling I The cautious seldom err. Confucius.
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 Entity Relationship Diagrams (ERDs)
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R.
Converting ER model Into Relational Table
Mid term Exam COVERS chapters 1-3, 7-8 Two parts In class Take home part (given on Oct 29 th, Due Nov5th in class)
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Chapter 5 Entity Relationship (ER) Modelling
Entity-Relationship Model Ch. 3
Fundamentals of Database Management Systems, 2nd ed
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
Mid term Exam COVERS chapters 1-3, 7-8 Two parts In class Take home part (given on Oct 29 th, Due Nov5th in class)
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
File and data base concepts DB design. Webcast will cover n Databases n Entities n Basic ERD n PK & FK n Basic Database Design.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
CS 370 Database Systems Lecture 9 The Relational model.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Data Modeling Using the Entity-Relationship (ER) Model.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
Lecture 03 Entity-Relationship Diagram. Chapter Outline.
1 The Entity- Relationship Model Instructor: Mohamed Eltabakh Part-2.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Data Modeling and the Entity-Relationship Model CS 475 Lecture Notes.
Levels of Database Modeling High degree of abstraction Conceptual model User view 1 User view 2 Implementa- tion model Physical model Medium degree of.
Database vs File System Integrated Data Reduced Data Duplication Program/Data Independence Easier representation for user Separate/Isolated data Appl.
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
ENTITY RELATIONSHIP DIAGRAM. Objectives Define terms related to entity relationship modeling, including entity, entity instances, attribute, relationship.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
C_ITIP211 LECTURER: E.DONDO. Unit 4 : DATA MODELING.
Entity Relationship Modeling
Tables and Their Characteristics
Database Design – Lecture 4
ERD :: 19 / 1 / Entity-Relationship (ER) Modeling. ER Modeling is a top-down approach to database design. Entity Relationship (ER) Diagram –A.
Entity-Relationship Model and Diagrams (continued)
Database Systems: Design, Implementation, and Management Tenth Edition
Entity Relationship Model
Entity Relationship Model
Database Systems Instructor Name: Lecture-11.
ERD (Entity Relationship Diagrams)
Database Systems Instructor Name: Lecture-9.
Relationships—Topics
Chapter 4 Entity Relationship (ER) Modeling
MIS2502: Data Analytics Relational Data Modeling 2
Chapter # 4 Entity Relationship (ER) Modeling.
Presentation transcript:

Lecture 3 Entity Relationship diagram (ERD) Cardinalities Converting ERD into tables (relations) An ERD example Q8/p139 INSS 651

Entities An object of interest Person Place Event Concept Ex: Student Order Customer INSS 651

Super & Sub Type Entities Recognize common theme WORKER (SUPER TYPE) PART TIME (SUB TYPE) FULL TIME (SUB TYPE) CONTRACTUAL (SUB TYPE) INSS 651

Relationship “Has A” between entities “IS A” between super & sub entities TEAM PLAYER WORKER PART TIME FULL TIME INSS 651

INHERITANCE Sub type entities inherit all attributes & procedures of its SUPER entity type Also the basis of Objects INSS 651

Attributes Properties of an entity Describes an entity Ex: attribute of an entity STUDENT student name student address etc INSS 651

Domain Set of allowable values for an attribute Ex: Student_age (between 15-85) Student _classification (Graduate or Undergraduate) INSS 651

Relationship Exists between entities Recursive ..within itself Binary between TWO entities Ternary between THREE entities INSS 651

Nature of Relationship between ENTITIES 1:1 (one is to one) 1:m (one to many) m:n (many to many) INSS 651

Recursive An entity has relationship to itself, it could be 1:1; 1:m or m:n EX: EMPLOYEES MARRIED TO OTHER EMPLOYEES EMPLOYEE INSS 651

CREATE A TABLE WITH EMP_SPOUSE NUMBER ADDED TO IT EMPLOYEE (EMP_NO, EMP_NAME,…,SPOUSE_NO) INSS 651

Cardinalities Relates specific occurrences of ONE entity to other, and vice-versa MIN cardinality MAX cardinality STUDENT COURSE INSS 651

Min, Max STUDENT <------->CLASS What’s the minimum number of classes a student can take zero, what’s the max, say 6 What’s the minimum number of students a class can have say 1, max say 40 (class limit), then STUDENT<------->CLASS (0,6) (1,40) INSS 651

Another Cardinality Example Patient Pat_history What’s the minimum number of patient history a patient can have? 1 What’s the maximum ? Many, say N What’s the minimum number of patient a patient history can belong to? Maximum? INSS 651

Patient Pat_history (1, N) (1,1) INSS 651

Converting 1:1; 1:m and m:n into relations Each entity becomes a relation and PK of either entity becomes a FK in the other entity ASSUME AN EMPLOYEE CAN have only one car and a car belongs to only ONE employee EMPLOYEE CAR Relations: EMPLOYEE (emp_no, emp_name,..,car_id) CAR (car_id, model, make…) Note: or emp_no could be FK in CAR INSS 651

1:m PK of PARENT becomes FK in the CHILD Ex: Assume: A team can have many players and a player can play for ONLY ONE team TEAM PLAYER TEAM (Team_name, location, manager,..) PLAYER (Player_name,…Team_Name) INSS 651

M:N Convert m:n into TWO 1:m by introducing an intersection entity The intersection contains PK of both entities CLASS STUDENT CLASS GRADE STUDENT CLASS (class_id, # of students,..) STUDENT (st_id, st_name, GPA,..) GRADE (class_id, st_id, semester, grade,..) INSS 651

EX: Convert following ERD into relations assume a student can be advised by one professor but a professor can advise many students, a club can have many students but a student can join only one club, then the ERD will look as STUDENT PROFESSOR CLUB INSS 651

Relations will be STUDENT (St_ID, st_name,…,Club_ID, Prof_ID) Note: we must account for both relationships in STUDENT entity (student, professor) AND (student, club) CLUB (Club_ID, location,date_established,..) PROFESSOR (Prof_ID, Prof_name, specialty,..) INSS 651

Building an ER model Q8/P139 Identify entities DINNER ENTRÉE GUEST INSS 651

Relationships Each dinner is based on a single entrée, but each entrée can be served at many dinners DINNER ENTREE INSS 651

Cardinality Cardinality One entrée can be part of a min of 1 dinner and a max of many dinners, say n One dinner can be part of a minimum of one entrée and a max of one entrée (1,N) (1,1) entree dinner INSS 651

Relationship between DINNER and GUEST Note there are TWO relationships A guest can attend many dinners Vice versa A guest can have many dinner invitations invitation Dinner Guest INSS 651

Relationship between DINNER and GUEST Note there are TWO relationships A guest can attend many dinners Vice versa Dinner Guest Attend INSS 651

Relationship between DINNER and GUEST Second relationship A guest can have many dinner invitations Vice versa invitation Dinner Guest INSS 651

Converting m:n into two 1:m since Guest and DINNER is m:n we can break into TWO 1:m i.e ATTEND entity is intersection of DINNER & GUEST DINNER ATTEND GUEST INSS 651

cardinality What is ATTEND entity ? a combination of a dinner and a guest What’s the min number of DINNER in ATTEND? 1 (a dinner must be part of at lest ONE function (ATTEND) Max number? N (assuming N is total # of dinners) An attend can be part as a min part of one dinner and a max of ONE dinner also what’s the min number of ATTEND a GUEST can have?0 (a guest may not attend any dinner) or they may attend a max of N dinners DINNER ATTEND GUEST (1,N) (1,1) (1,1) (0,N) INSS 651

Same concepts can be applied to INVITATION intersection entity INSS 651

ERD Q 8/p139 INSS 651

INSS 651