The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006.

Slides:



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

High-Level Database Models Spring 2011 Instructor: Hassan Khosravi.
Relational Database Design Via ER Modelling
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Text-Book Chapters (7 and 8) Entity-Relationship Model
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Design Principles: Faithfulness
Entity-Relationship Model. The process of designing a database begins with: –an analysis of what information the database must hold, and –the relationships.
Design Principles: Faithfulness
Entity-Relationship Model Lecture 2. Database Modeling and Implementation Process Ideas ER DesignRelational Schema Relational DBMS Implementation.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity-Relationship Model
A four-way Relationship
The Entity-Relationship Data Model
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
1 The Entity-Relationship Data Model Chapter 2 (Database Design)
Chapter 2: Entity-Relationship Model (Continued)
Entity-Relationship (E-R) Model
CS411 Database Systems Kazuhiro Minami
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.
Data Modeling Using the Entity-Relationship Model
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
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.
the Entity-Relationship Model
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Entity-Relationship Model
Database Systems 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 Systems Lecture # 7 8 th Feb, Conceptual and Logical Design Person buys Product name pricenamessn Conceptual Model: Relational Model: (plus.
Conversion E/R to Relational CIS 4301 Lecture Notes Lecture 6 - 1/31/2006.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
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 11 & 12 Entity-Relationship (E-R) Model Characteristics of E-R Model Components of E-R Model Example of E-R Model Enhanced E-R Model.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.
Entity-Relationship Model
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 2 Introduction to a First Course in Database Systems.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Home Work. Design Principles and Weak Entity Sets.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
© Shamkant B. Navathe CC Enhanced Entity-Relationship Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Data Modeling and the Entity-Relationship Model CS 475 Lecture Notes.
April 20022/CS/3X EER 1 Database Design Enhanced entity-relationship modelling John Wordsworth Department of Computer Science The University of Reading.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
Modeling: Entity-Relationship Diagrams
1 Database Modeling (Semantic data modeling) ER Data Model –A high-level conceptual data model –Proposed by P. Chen (1976) –Widely used in DB design process.
The Entity-Relationship Diagram for Data Modeling
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 6: Entity-Relationship.
ER Diagrams and Relational Model CS 174a (Winter 2015)
Chapter 2: Entity-Relationship Model
Hele-Mai Haav: CSC210-Spring*01 CSC230-Spring*03 Database Design.
COP Introduction to Database Structures
Chap 3. High-Level Database Models
Entity Relationship Model
Entity-Relationship Model
Outline of the ER Model By S.Saha
Chapter 6: Entity-Relationship Model
Presentation transcript:

The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006

Lecture 2© CIS Spring Database Modeling Analysis of what information the database must hold Relationships among components of that information Database schema is specified in one of several languages or notations suitable for expressing designs Next, design is committed to a form which can be input to a DBMS  DB takes on physical existence Design notation in this course is Entity-Relationship (E/R) model Ideas ODL, UML, etc. E/R Object-Oriented DBMS Relational DBMS Relations

Lecture 2© CIS Spring Entity-Relationship Model Entity: Real-world object, concept, or event Entity type/set: Collection of entities of the same type; sets don’t have to be distinct Attribute: Values describing some property of an entity simple vs. composite single-valued vs. multi-valued stored vs. derived Relationship: Association between two or more entity sets Relationship type/set: Collection of relationships

Lecture 2© CIS Spring Examples - “Movie Database” Entity: Movie, Star Attributes: Name : “Harrison Ford” (simple, single-valued, stored) Address : “123 Main Str., LA, CA” (complex) Birthdate : “1-1-50” (simple) Age : 50 (could be derived from Birthdate and current date) Entity Types: Stars (Name,Address,Birthdate,Age) Movies(Title,Year,Length,FilmType)

Lecture 2© CIS Spring E/R Diagrams - Notation Entity Set Relationship Set Attribute Multivalued Derived... Composite Attribute Role Name

Lecture 2© CIS Spring Sample Movie Database Movies Studios Stars Owns Stars-in titleyear length filmType nameaddress name streetcityzip

Lecture 2© CIS Spring Relationships Define associations among entities Grouped together into relationships sets (types) Example: Relationship type: Stars-in between Movies and Stars Can be visualized as a table MoviesStars A. SchwarzeneggerTotal Recall Sharon StoneTotal Recall Sharon StoneBasic Instinct Relationships Relationship Type Stars-in

Lecture 2© CIS Spring Relationships Cont’d Degree of a relationship type is the number of participating entity types binary, ternary, n-ary Another example: Entities: Stars, Movies, Studios Ternary Relationship Set: Contracts Each entity type that participates in a relationship type plays a role in the relationship Marked by (optional) name Entity type may play multiple roles in a relationship type (see example later)

Lecture 2© CIS Spring Relationships Cont’d Relationships can have attributes Example: Relationship type Contracts between Stars and Studios for Movies Might want to record salary associated with each contract Not necessary to place attributes on relationships; instead, can invent new entity type whose entities have the attributes ascribed to the relationship

Lecture 2© CIS Spring Multiplicity of Binary Relationships Limit the possible combinations of entities that participate in the relationship type Derived from real-world scenario which is being modeled a.k.a cardinality ratio Specifies the number of relationships an entity can participate in 1:1, 1:N, N:1, N:M Example: Stars-in between Stars and Movies is N:M from Stars to Movies

Lecture 2© CIS Spring Multiplicity In a many-many relationship, an entity of either set can be connected to many entities of the other set In a many-one relationship, each entity of the first set is connected to at most one entity of the second set An entity of the second set can be connected to zero, one, or many entities of the first set In a one-one relationship, each entity of either set is connected to at most one entity of the other set

Lecture 2© CIS Spring In Pictures… many-many many-oneone-one

Lecture 2© CIS Spring Multiplicity in the E/R Model Use arrow pointing to “one” side of relationship many-many many-one one-one N N N1 11 letters optional

Lecture 2© CIS Spring Sample Movie Database Movies Studios Stars Owns Stars-in titleyear length filmType nameaddress name M N 1 N streetcityzip

Lecture 2© CIS Spring Multi-way Relationships Movies Studios Stars Contracts 1 N N MoviesStars SchwarzeneggerTotal Recall Sharon StoneTotal Recall Sharon StoneBasic Instinct Studios MGM Universal H. FordStar WarsFox “1” means that if we select one entity from each of the other entity sets in the relationship, those entities are related to a unique entity in Studios “Contracts” Relationship Ternary

Lecture 2© CIS Spring Multi-way Relationships Movies Studios Stars Contracts 1 N N “1” means that if we select one entity from each of the other entity sets in the relationship, those entities are related to a unique entity in Studios 1 Producing Studio Studio of Star 4-way

Lecture 3© CIS Fall Subclass/Superclass Often, class contains certain objects that have special properties not associated with all members Useful to organize class into subclasses Each having its own special attributes and/or relationships In addition to those of the superclass Example Superclass: Movies Subclasses: Cartoons, Mystery, Science- Fiction

Lecture 3© CIS Fall Subclass in E/R Diagrams Assume subclasses form a tree (i.e., no multiple inheritance) ISA triangles indicate subclass relationship Point to the superclass

Lecture 3© CIS Fall Example Movies titleyearlengthfilmType Cartoons Murder Mysteries weapon Voices N M Indicates direction of superclass/subclass relationship ISA

Lecture 3© CIS Fall Inheritance Entity in subclass represents same real-world entity as in the superclass Should possess values for its specific attributes As well as values for the attributes it inherits from its superclass Entity inherits all attributes defined on superclass and the relationships in which superclass participates

Lecture 3© CIS Fall E/R vs. Object-Oriented Subclasses In object-oriented world, objects are in one class only Subclasses inherit properties from superclasses In contrast, E/R entities have components in all subclasses to which they belong

Lecture 3© CIS Fall Example Movies titleyearlengthfilmType Cartoons Murder Mysteries weapon Voices How do we represent a cartoon-murder- mystery? N M contents may overlap ISA The Pink Panther

Lecture 3© CIS Fall Another Example Accounts account-number balance Savings Accounts Checking Accounts overdraft-amountinterest-rate contents are disjoint ISA disjoint

Lecture 3© CIS Fall Design Principles Faithfulness Avoid redundancy Relationship Owns between Movies and Studios; adding attribute studioName to Movies would be redundant Simplicity counts Movies Studios Owns Name Studio Name redundant

Lecture 3© CIS Fall Example Movies Studios Stars Owns Stars-in titleyear length filmType nameaddress name M N 1 N streetcityzip Works for ??

Lecture 3© CIS Fall Design Principles Picking the right kind of element Many of the choices are between using attributes and using entities E.g., Should we have eliminated Studios and made name and address attributes of Movies instead? If something has more info than just a name, it probably needs to be an entity type

Lecture 3© CIS Fall Example Movies Stars Stars-in titleyear length filmType nameaddress name M N streetcityzip ??

Lecture 3© CIS Fall Example AcctSetsCustomers Accounts Addresses number balance Member of address Lives at Has name owner- address