Data Modeling Translating E-R Diagrams to Relations

Slides:



Advertisements
Similar presentations
Database Management Systems Chapter 3 The Relational Data Model (I) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
Advertisements

CSCI 305 – Fall 2013 The Entity-Relationship Model Based on Slides by Prof. Brian King.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
1 Convert E/R to Relation May 18, Entity Set -> Relation Relation: Beers(name, manf) Beers name manf.
Databases : Relational Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman distributes.
Entity-Relationship Model
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
1 Relational Model and Translating ER into Relational.
The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file.
1 Announcement Recitation time  Before midterm: 6-7pm, by Earl Wagner  After midterm: 5-6pm, by Yi Qiao Newsgroup safe to subscribe  Will not cause.
Entity-Relationship Data Model Alex Ostrovsky. Presentation Overview ► Short historical overview ► Elements of E-R Model ► Basic organization & relationships.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
From E/R Diagrams to Relations. The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes.
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Source: slides by Jeffrey Ullman.
Winter 2002Arthur Keller – CS 1803–1 Schedule Today: Jan. 10 (TH) u Relational Model, Functional Dependencies. u Read Sections Jan. 15 (T) u Normal.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Winter 2002Arthur Keller – CS 1802–1 Schedule Today: Jan. 8 (T) u Weak Entity Sets, Entity-Relationship Design. u Read Sections Jan. 10 (TH) u.
ER Diagram Notation. E-R Diagram: Chen Model Entity – represented by a rectangle with its name in capital letters. Relationships – represented by an active.
CS411 Database Systems Kazuhiro Minami
What is a Database Management System? 1. Manages very large amounts of data. 2. Supports efficient access to very large amounts of data. 3. Supports concurrent.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
Entity-Relationship Data Model N. Harika Lecturer(csc)
Constraints on Relations Foreign Keys Local and Global Constraints Triggers Following lecture slides are modified from Jeff Ullman’s slides
1 Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Database Management Systems Chapter 2 The Entity-Relationship Data Model Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
Dale Roberts Object Oriented Programming using Java - OOD to OOP: ATM Case Study Dale Roberts, Lecturer Computer Science, IUPUI
An Entity Relationship (ER) Diagram is a graphic that shows the interrelationship between entities in a database.
Entity-Relationship Model
 Primary keys allow entity sets and relationship sets to be expressed uniformly as relations  E/R diagram  collection of tables  For each entity set.
SAnta Clara UniversityHolliday – COEN 1782–1 Today’s Topic Today: u Constraints, Weak Entity Sets, Entity- Relationship Design. u Read Sections
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
Winter 2006Cushing Keller UllmanJudy Cushing2–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the.
Dale Roberts 11/26/ Department of Computer and Information Science, School of Science, IUPUI Fall 2003 Dale Roberts, Lecturer Computer Science, IUPUI.
CS 405G: Introduction to Database Systems Lecture 5: Logical Design by Relational Model Instructor: Chen Qian.
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Instructor: Jinze Liu Fall Phases of Database Design u Conceptual design begins with the collection of requirements and results needed from the.
Santa Clara UniversityHolliday – COEN 1783–1 Today’s Topic Today: u Relational Model, Functional Dependencies. u Read Sections Next time u Normal.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 4 Introduction to a First Course in Database Systems.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Functional Dependencies.
CS 405G: Introduction to Database Systems Relations.
1 Entity Relationship Diagram. ER proposed by Peter Chen ER diagram is widely used in database design Represent conceptual level of a database.
Winter 2002Arthur Keller – CS 1802–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Computational Biology Dr. Jens Allmer Lecture Slides Week 5.
1 Database Design: DBS CB, 2 nd Edition Logical Database Model: Entity Relationship Model & Object Description Language & Unified Modeling Language Ch.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes.
Database Design and Programming Jan Baumbach Adopted from previous slides of Peter Schneider-Kamp.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture.
Introduction to Database Systems, CS420
Entity-Relationship Model
Cushing, Keller, UlmanJudy Cushing
CPSC-310 Database Systems
Instructor: Zhe He Department of Computer Science
CPSC-310 Database Systems
CPSC-310 Database Systems
IST 318 Database Administration
The Relational Data Model
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
Database Dr. Roueida Mohammed.
CS 405G: Introduction to Database Systems
Presentation transcript:

Data Modeling Translating E-R Diagrams to Relations Department of Computer and Information Science, School of Science, IUPUI Data Modeling Translating E-R Diagrams to Relations Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu

From E-R Diagrams to Relations Entity set -> relation. Attributes -> attributes. Relationships -> relations whose attributes are only: The keys of the connected entity sets. Attributes of the relationship itself.

Entity Set -> Relation Relation: Beers(name, manf) name manf Beers

Relationship -> Relation name name addr manf Drinkers Likes Likes(drinker, beer) Beers Married husband wife Married(husband, wife) Buddies 1 2 Buddies(name1, name2) Favorite Favorite(drinker, beer)

Combining Relations OK to combine into one relation: The relation for an entity-set E The relations for many-one relationships of which E is the “many.” Example: Drinkers(name, addr) and Favorite(drinker, beer) combine to make Drinker1(name, addr, favBeer).

Risk with Many-Many Relationships Combining Drinkers with Likes would be a mistake. It leads to redundancy, as: name addr beer Sally 123 Maple Bud Sally 123 Maple Miller Redundancy

Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own, nonkey attributes. A supporting relationship is redundant and yields no relation (unless it has attributes).

Enterprise E-R Diagrams Placing attributed in ovals, and listing every relationship with diamonds in okay in small models are in an academic exercise. Enterprise E-R Diagrams contains hundreds of entities and thousands of attributes. A more compact representation is necessary. Rectangles are entities, lines are relationships, associative entities (use to resolve many-many) are diamonds. Cardinality is included on relationship lines (0, 1, Many = “crows feet”) 4/24/2017

TicketMaster Example

Relationship Naming Relationships are labeled with verbs Relationships go both directions, each with its own verb. Relationships are read in both directions choosing the “clockwise” verb and cardinality on the terminating end of the relationship. Student Major declares rosters “Each student declares exactly one Major.” “Each Major rosters zero to many Students.”

Logical vs Physical E-R Diagrams E-R Tools support logical and physical diagrams. Logical diagrams are 3NF and allow Many-Many relationships Physical diagrams resolve Many-Many using associative entities Performance tuning may denormalize (add redundancy) to the physical model in order to reduce joins and improve WHERE clause performance. Recommendation: Never remove normalized entities, only add redundancy in a controlled way.

Acknowledgements McFadden and Hoffer. Database Management Loney, Kevin. Oracle Database 10g The Complete Reference Ullman, Jeff. Database Systems The Complete Book. DatabaseAnswers.com 4/24/2017