© D. Wong 2003 1 Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.

Slides:



Advertisements
Similar presentations
High-Level Database Models Spring 2011 Instructor: Hassan Khosravi.
Advertisements

Constraints in Entity-Relationship Models Zaki Malik September 18, 2008.
Information Systems Chapter 4 Relational Databases Modelling.
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Design Principles: Faithfulness
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
Design Principles: Faithfulness
Databases Revision.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Movies length titleyearfilmType Voices isa Cartoons isa MurderMystery weapon toStar Our Movie Example.
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
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.
The Entity-Relationship Data Model
1 Lecture 3: Database Modeling (continued) April 5, 2002.
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 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
CS411 Database Systems Kazuhiro Minami
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
3.1 CSIS 3310 Chapter 3 The Entity-Relationship Model Conceptual Data Modeling.
Chapter 4 The Relational Model Pearson Education © 2014.
Relational Model Session 6 Course Name: Database System Year : 2012.
Chapter 4 The Relational Model.
Entities and Attributes
Relational Data Model. A Brief History of Data Models  1950s file systems, punched cards  1960s hierarchical  IMS  1970s network  CODASYL, IDMS 
Database Systems The Entity-Relationship Model
Chapter 5 Entity–Relationship Modeling
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Concepts and Terminology Introduction to Database.
Database Management COP4540, SCS, FIU Relational Model Chapter 7.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 3 Introduction to a First Course in Database Systems.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
Conversion E/R to Relational CIS 4301 Lecture Notes Lecture 6 - 1/31/2006.
Slide Chapter 5 The Relational Data Model and Relational Database Constraints.
©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.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Tallahassee, Florida, 2015 COP4710 Database Systems E-R Model Fall 2015.
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.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Home Work. Design Principles and Weak Entity Sets.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
CS 157B Database Systems Dr. T Y Lin. Updates 1.Red color denotes updated data (ppt) 2.Class participation will be part of “extra” credits to to “quiz.
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.
Data Modeling Using the Entity-Relationship (ER) Data Model.
The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
Logical Database Design and the Relational Model.
The Relational Model © Pearson Education Limited 1995, 2005 Bayu Adhi Tama, M.T.I.
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
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.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
© D. Wong Ch. 3 (part 1)  Relational Model basics  From E/R diagram to Relations.
Lecture 3 A short revision of ER and EER modelling See R. Elmasri, S.B. Navathe. Fundamentals of Database Systems (third edition) Addison-wesley. Chapter.
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.
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.
The Entity-Relationship Diagram for Data Modeling
ER Diagrams and Relational Model CS 174a (Winter 2015)
Logical Database Design and the Rational Model
Chap 3. High-Level Database Models
COP4710 Database Systems E-R Model.
Constraints in Entity-Relationship Models
Review of Week 1 Database DBMS File systems vs. database systems
Chapter 3: Multivalued Dependencies
Session 5: Weak Entity Sets and ER Model to Relational ( )
Presentation transcript:

© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints  Weak entity sets

© D. Wong Entity-Relationship Diagrams Symbols attributes relationships entity sets Cardinality (Multiplicity): one - one many - one m many - many m n

© D. Wong Entity-Relationship Diagrams (continue 1)  Entity –Has a set of attributes –The key is underlined  Key –Attributes which uniquely identify an entity in an entity set –An inherent property of the data (e.g. movie title and year) –Serve as a constraint SS#

© D. Wong Entity-Relationship Diagrams (continue 2)  Multiway relationships  Relationships with roles  Attributes on relationships –E.g. salary of a star for a movie –Not necessary by adding new entity set, whose entities have the attributes

© D. Wong E/R Diagrams Multiway relationships  Can be converted to a collection of binary, many- one relationships –Introduce new entity set (connecting entity set)  Entities are tuples of the relationship set for the multiway relationship –Introduce many-one relationships from the connecting entity set to each of the entity sets that provide components of tuples in the original, multiway relationship

© D. Wong ER Diagrams –Inheritance  Subclasses –special-case entity sets with own special attributes and/or relationships  isa relationship : One-One relationship to handle inheritance, to connect entity set to its subclasses. –E.g. every Cartoon is a Movie  ER symbol for isa : isa Super class Subclass (arrows not drawn)

© D. Wong Design Principles  Faithfulness : Reflects the reality of the data and the problem with the appropriate: –attributes –data ranges –relationships –cardinality E.g. Stars Movies Stars -in

© D. Wong Design Principles (2)  Avoid Redundancy –Redundancy : duplicate representation of data, lead to  Inconsistency, violate data integrity  Waste space E.g. Studios Movies Owns Studio_name

© D. Wong Design Principles (3)  Keep it simple : Avoid more elements than needed  Pick the right kind of element –attributes or entity set –what should the relationships be

© D. Wong DB design  Centers on the entity sets and relationships making up the database.  Users and designers must work together to: –Specify the entity sets and relationships and their meanings –Specify the attributes and the meaning of it –Specify the constraints –Identify key attributes of entity sets –Specify how the data would be viewed –Specify who can view and modify what and when  Better to do a good job in the original design –Need collaboration of users and designers  Reminder: Changing database design later usually very costly.

© D. Wong Constraints  Constraints are part of the schema, not of an instance of the database.  Classification of Constraints –Keys –Single-value constraints –Referential integrity constraints –Domain constraints –General constrains

© D. Wong Keys in the E/R Model  Key for an entity set E is a set K of one or more attributes such that, given any two distinct entities e 1 and e 2 in E, e 1 and e 2 cannot have identical values for each of the attributes in the key K. (Ref ) –E.g. Movie(title, year, length, filmtype), E1 = (titanic, 1960, 120, color), E2 = (titanic, 1997, 180, color) –A key can consist of more than one attribute –There can be more than one possible key (candidate keys), but designate one as the “primary key”. –Attributes that constitute the primary key cannot be null –If the entity set is in an isa-hierarchy, require the root entity set have all the attributes needed for a key. –In E/R diagram, attributes of a key are underlined

© D. Wong Single-Value Constraints  Assertion: at most one value exists in a given context  Ways to express single-value constraints in E/R: –Each attribute of an entity set has a single value  Some attributes may allow null  Key attributes should not be null  No formal representation in E/R diagram, make a notation beside the attribute –Many-one relationship E F R

© D. Wong Referential Integrity  Assertion: exactly one value exists in a given role  Enforced at database implementation –Forbid the deletion of a referenced entity –Require that if referenced entity is deleted, then all entities that reference it are deleted as well.  Use a rounded arrow in the diagram MoviesStudios Owned by 

© D. Wong Other kinds of constraints  Domain constraints : restrict the value of an attribute to be in a limited set. –No formal notation in E/R, place a notation next to the attribute –E.g. declaring the type of an attribute –E.g specify range for the attribute value  General constraints –E.g. degree of the relationships MoviesStars Stars-in <=10

© D. Wong Definition: An entity set whose key is composed of attributes some or all of which belong to another entity set. Causes: 1.entity sets in a hierarchy based on classification 2.Connecting entity sets to eliminate a muliway relationship. Weak Entity Sets Unit-of Crew Studios number name addr

© D. Wong Weak Entity Sets Requirements 1. Key consists of zero or more of its own attributes, and 2. Key attributes from entity sets that are reached by supporting relationships (many-one) 3. R is a supporting relationship for a weak entity set E to some entity set F, R must: –Be a binary, many-one relationship from E to F –R must have referential integrity from E to F –The attributes that F supplies for the key of E must be key attributes of F –If F is weak, then key attributes of F supplied to E may be attributes of some entity set to which F is connected by a supporting relationship (recursive) –For multiple supporting relationship from E to F, each relationship is used to supply a copy of the key attributes of F