Murali Mani The Entity- Relationship Model. Murali Mani Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design.

Slides:



Advertisements
Similar presentations
Entity Relationship (ER) Modeling
Advertisements

Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
The Entity-Relationship Model Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Chapter 4 Conceptual Modeling of Databases with Entity-Relationship Diagrams and the Unified Modeling Language.
CS34311 Translating ER Schema to Relational Model.
Murali Mani The Relational Model. Murali Mani Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2004 Pearson Education, Inc.. Chapter 3 Data Modeling Using the Entity-Relationship Model.
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
CS34311 The Entity- Relationship Model. CS34312 Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design Conceptual.
CS34311 The Entity- Relationship Model Part II.. CS34312 Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
3.1 CSIS 3310 Chapter 3 The Entity-Relationship Model Conceptual Data Modeling.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Database Systems Lecture # 7 8 th Feb, Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 1 © Akhilesh Bajaj, 2000, 2002, 2003, 2004.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
Entity-Relationship Modeling Based on Chapter 12.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
CS3431: C-Term The Entity- Relationship Model Part II. Instructor: Mohamed Eltabakh
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.
Entity-Relationship Model
Chapter 3 Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Databases Illuminated Chapter 3 The Entity Relationship Model.
CS34311 Translating ER Schema to Relational Model.
1 The Entity- Relationship Model Instructor: Mohamed Eltabakh
advanced data modeling
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
1 The Entity- Relationship Model Instructor: Mohamed Eltabakh Part-2.
CS34311 The Entity- Relationship Model Part I.. CS34312 Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
CS34311 The Entity- Relationship Model Part III..
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
Data Modeling and the Entity-Relationship Model CS 475 Lecture Notes.
Modeling Your Data Chapter 2 cs5421. Part II Discussion of the Model: Good Design/ Bad Design? cs5422.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity- Relationship Model (Continued)
CS3431-B111 The Entity- Relationship Model Part II. Instructor: Mohamed Eltabakh
CS34311 Translating ER Schema to Relational Model.
The Relational Model Lecture #2 Monday 21 st October 2001.
COP Introduction to Database Structures
Chapter 3 Data Modeling Using the Entity-Relationship Model
Outline of the ER Model By S.Saha
Translating ER Schema to Relational Model
The Entity-Relationship Model
Guidelines Towards Good Design
The Entity-Relationship Model
Entity Relationship Diagrams
Chapter 7: Entity-Relationship Model
Presentation transcript:

Murali Mani The Entity- Relationship Model

Murali Mani Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design Conceptual Schema Logical Schema Physical Schema

Murali Mani Conceptual Design What is conceptual Design? Concise representation of our DB application requirements Conceptual Models ER (Entity Relationship) Model, UML (Unified Modeling Language), ORM (Object Role Modeling) etc ER Model Structures: entities and relationships Constraints An ER schema is represented as an ER diagram.

Murali Mani ER Model: Entity Types and Attributes Entity: “Object” Entity Type: “Class” Attribute: property of an entity, has a domain In ER diagrams Entity Type  rectangle Attribute  Oval. Entity Type Student with attributes (sNumber, sName, sAge)

Murali Mani ER Example Consider DB instance with 3 students (1, Joe, 21), (2, Mary, 20), (3, Emily, 20)

Murali Mani ER Model: Complex Attributes Composite Attribute: addressMultivalued Attribute: major Student entity type with all its attributes

Murali Mani ER Model: Relationship Types Relationship: Association between entities Relationship Type: class of relationships Represented as diamond Relationship type HasTaken to represent Courses taken by Students

Murali Mani ER Model: Relationship Types with Attributes Relationship HasTaken has an attribute project which is the project the Student did for the Course

Murali Mani Example: Relationship Instance Consider students {Hong, Song}, courses {DB1, DB2}, and the relationships {(Hong, DB1, 98), (Song, DB1, 99), (Hong, DB2, 97)}

Murali Mani N-ary relationship type Ternary relationship type: Supplier supplies Products to Consumers Note: This is NOT equivalent to 2 binary relationships

Murali Mani Recursive Relationship Types and Roles Part-Subpart recursive relationship type Roles: There are Parts that play the role of superPart There are Parts that play the role of subPart

Murali Mani ER Model so far Structures Entity Types Relationship Types Binary, ternary, n-ary Recursive Attributes For entity types and relationship types Simple, composite, multivalued Roles

Murali Mani ER Model: Key Constraints Underline the key attribute/attributes Key for Student is sNumber Key for Movie is Note: We can represent key for an entity type consists of more than 1 attribute (eg: Movie) We cannot represent multiple keys for an entity type (eg: key for Student can be either sNumber or sName)

Murali Mani ER Model: Cardinality Constraints Expressed using (min, max) Student can take >= 2 and <= 3 Courses Course can have >= 0 and <= * (infinity) Students min and max are non-negative integers max >= min

Murali Mani Cardinality Constraints 1:1 relationship type: A Dept has exactly one Manager, A Person can manage atmost one Dept 1:many (1:n) relationship type: A Person works for exactly one Dept, A Dept can have any number of Persons

Murali Mani Cardinality Constraints many:many (m:n) relationship type: A Person works for one or more Depts, A Dept can have any number of Persons

Murali Mani Cardinality Constraints for n-ary relationships A Supplier supplies at least one Product to some Consumer We cannot specify: A Consumer gets a Product from only one Supplier Each Supplier supplies exactly 2 Products

Murali Mani Cardinality Constraints for Recursive Relationships A Part can be subpart of one superPart A Part can have many subParts A Part can be subpart of many superParts A Part can have many subParts

Murali Mani ER Model Constraints Summary Key Constraints Cardinality Constraints Expressed using (min, max) Binary relationship types are called 1:1, 1:many, many:many

Murali Mani An Application Example Courses offered in CS Dept, WPI, in A term What entity types? – Student, Professor, Course, GradStudent Attributes and key constraints for entity types What relationship types? Cardinality for Relationship Types

Murali Mani Possible Solution

Murali Mani ER Model: ISA Relationship Types Similar to “subclass” Students can be UGStudents or GradStudents UGStudents take Classes, GradStudents are TAs for Classes GradStudents are advised by Professors

Murali Mani

ISA Note: Implicit 1:1 relationship Key for subtype is same as key for supertype Subtypes can have additional attributes

Murali Mani Weak Entity Types Consider Depts and Courses The Courses offered by a Dept are identified by Cnumber Course is weak entity type Its identifying relationship is Offers Its identifying entity type is Dept A weak entity type can have multiple identifying relationship types and entity types Note: The cardinality of the weak entity type in a identifying relationship type is (1, 1)

Murali Mani Summary of ER Structures Entity Types Relationship types – binary, ternary, n-ary. recursive Attributes For entity types or relationship types Simple, composite or multi-valued Constraints – key, cardinality Roles of entity types in a relationship type ISA relationship types Weak Entity Types – identifying relationship type, identifying entity type

Murali Mani Coming up with a good design for your application Give good names to entity types, relationship types, attributes and roles

Murali Mani Good Design: Attribute or entity type? Should we represent something as an attribute or entity type? How should dept be represented? (or)

Murali Mani Good Design: Keep it simple Do not introduce unnecessary entity types (or) Entity type Contract Is unnecessary

Murali Mani Good Design: Determine correct cardinality constraints (or)

Murali Mani Good Design: Try to avoid redundancy Redundant attribute Attribute dNum is redundant

Murali Mani Good Design: Try to Avoid redundancy Redundant relationship type Relationship Type IsObtainedBy is redundant