From data needs to ER Model to relational DB Schema

Slides:



Advertisements
Similar presentations
The transformation of an ER or EER model into a relational model
Advertisements

1 Assignment 4 Map entities with relationships to relational schemas. Use DBDL to describe the table schemas.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Chapter 3 The Relational Model Transparencies © Pearson Education Limited 1995, 2005.
Fundamentals, Design, and Implementation, 9/e Chapter 5 Database Design.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Chapter 4 The Relational Model.
Concepts and Terminology Introduction to Database.
CS 370 Database Systems Lecture 9 The Relational model.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
Week 7-8 DBMS ER-Relational Mapping. ER-Relational Mapping.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
ER- Relational Mapping (Based on Chapter 9 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
Methodology - Logical Database Design. 2 Step 2 Build and Validate Local Logical Data Model To build a local logical data model from a local conceptual.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Data Modeling Using the ERD
Entity Relationship Model
Logical Database Design and the Rational Model
Entity- Relationship (ER) Model
Chapter 5 Database Design
Methodology Logical Database Design for the Relational Model
Relational Database Design by ER- and EER-to- Relational Mapping
Chapter 4 Logical Database Design and the Relational Model
Chapter 4: Logical Database Design and the Relational Model
Chapter 4: Part B Logical Database Design and the Relational Model
RELATION.
Chapter 5: Logical Database Design and the Relational Model
Entity-Relationship Model
Tables and Their Characteristics
Chapter -3- Data Modeling Using the Entity-Relationship Model
Relational Database Design by ER- and EER-to-Relational Mapping
ER- and EER-to-Relational
Constraints in Entity-Relationship Models
Entity-Relationship Modeling
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
Logical Data Modeling.
Assignment 4 Map entities with relationships to relational schemas.
Constraints AND Examples
Chapter (9) ER and EER-to-Relational Mapping, and other Relational Languages Objectives How a relational database schema can be created from a conceptual.
بسم الله الرحمن الرحيم.
Relational Database.
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 4 The Relational Model Pearson Education © 2009.
The Entity-Relationship Model
Entity Relationship Diagrams
Database Management System
Chapter 4 The Relational Model Pearson Education © 2009.
Foreign key (FK) is defined as follows:
Relational Database Design by ER- and EER-to-Relational Mapping
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
The Relational Model Transparencies
Chapter 4 The Relational Model Pearson Education © 2009.
Relational Database Design by ER- and EER-to-Relational Mapping
Lecture 9: The E/R Model II
Chapter 4 The Relational Model Pearson Education © 2009.
Chapter 7: Entity-Relationship Model
DBMS ER-Relational Mapping
Relationship Problems—Topics
Chapter 4 The Relational Model Pearson Education © 2009.
Mapping an ERD to a Relational Database
INSTRUCTOR: MRS T.G. ZHOU
Entity Relation Model Tingting Zhang.
Constraints AND Examples
Chapter (7) ER-to-Relational Mapping, and other Relational Languages
Mapping an ERD to a Relational Database
CS4222 Principles of Database System
Presentation transcript:

From data needs to ER Model to relational DB Schema Db Design Process From data needs to ER Model to relational DB Schema

NBA.com: the needs

What are the Entity sets? Name ID Type ? Location ? Location All “things” that listed in the banners? Entity (set) vs. Attribute: Should Location be an entity or an attribute? Team

2 relationships btw 2 entity sets: Is it possible? In every game, there are two teams engaged: One as the home team Another as away team Which one gives the correct answer? Game Game hasHm hasAw home away OR HomeTeam AwayTeam Team

Recursive relationship: what is it? Isn’t it true that each team just has one coach? What about specialty coaches and all the training staff? How to keep track them all and model the reporting structure? Team has reportsTo chief Coach asst

Relationship set or Entity Set: do it matter? Can I model the Game as a recursive relationship btw 2 (team) instances in the same Team entity sets? Would the outcome be any different? Game home PlaysAs away PlaysAs OR EngagedIn Team Game home Team away

The big picture: is it complete?

Cardinality constraints: why is it important? Three options 1:1 1:M/M:1 M:M (or M:N) # of tables needed 1 (or two, with other considerations) 2: with FK added to the many side 3: with a junction table for m:m mapping info  which is as important as value in the attributes!

Convert into relational model Tables and columns: Each entity set becomes a table A many-to-many relationship set becomes a table Each (atomic) attribute becomes a column Keys: “Composite” key in the junction tables: PK from both related entity sets Surrogate key: independent from changes in business domain

Foreign keys FK specifies a constraint btw a referencing table and a referenced table It’s not a key in the referencing table (although may be part of the key) It’s a key in the referenced table (often the PK, but can be any candidate keys) It has as many attr’s (or columns) as its referenced key It’s added to the table on the many-side during the conversion Referential integrity can be enforced by requiring FK to take values existing in its referenced key

More Complex situations: N-ary What is N-ary (relationship)? All relationships that we discussed so far are binary? Can a R involve more E’s? Think about the PlayerStats entity set: it actually relates Player, Game in which a Player plays, and An entity in the StatsCategory entity set Common practice is to convert a N-ary R into N binary ones

More Complex situations: attributes Composite attributes Name Address Multi-valued attributes Player position: multiple positions at the same time, or during different periods Player stats or performance history

More Complex situations: weak entity Section of Course Section cannot exist without a Course Section has only got a partial key: (Section_No, Year, Semester) It needs to borrow PK from Course: (Course_No) to form a unique of its own: (Course_No , Section_No, Year, Semester) Course has Section