Part3 Database Analysis and Design Techniques Chapter 05- Entity-Relationship Modeling Lu Wei College of Software and Microelectronics Northwestern Polytechnical.

Slides:



Advertisements
Similar presentations
Database Design: ER Modelling (Continued)
Advertisements

Chapter 12 Enhanced Entity-Relationship Modeling Transparencies © Pearson Education Limited 1995, 2005.
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
CSC271 Database Systems Lecture # 22. Summary: Previous Lecture  Applying Database SDLC on DreamHome  Database planning  System definition  Requirements.
Pertemuan Entity Relationship Diagram
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Lecture Eleven Entity-Relationship Modelling
Chapter 4 ENTITY-RELATIONSHIP MODELLING.
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Enhanced ER modeling techniques Transparencies
Entity-Relationship (E-R) Model
Chapter 4 Entity-Relationship modeling Transparencies © Pearson Education Limited 1995, 2005.
Data Modeling Using the Entity-Relationship Model
Entity-Relationship modeling Transparencies
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
1 Web-Enabled Decision Support Systems Entity-Relationship Modeling Prof. Name Position (123) University Name.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
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.
Team Dosen UMN ER Modelling Connolly Book Chapter
Entity-relationship Modeling Transparencies 1. ©Pearson Education 2009 Objectives How to use ER modeling in database design. The basic concepts of an.
Entity-Relationship Model
Entities and Attributes
Entity-Relationship Model. 2 Outline  What is ER Model? And Why?  Overview of Database Design Process  Example COMPANY Database  ER Model Concepts.
Chapter 5 Entity–Relationship Modeling
Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Entity Relationship Modeling
C HAPTER 11 Entity-Relationship modelling Transparencies © Pearson Education Limited 1995,
1 Pertemuan > > Matakuliah: >/ > Tahun: > Versi: >
9/10/2012ISC 329 Isabelle Bichindaritz1 Entity Relationship (E-R) Modeling.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
Entity-Relationship Modeling Based on Chapter 12.
1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
1 E-R Model (II) Keys To identify records in a table Candidate Key Primary Key Alternate Key Composite Key.
CSC271 Database Systems Lecture # 25. Summary: Previous Lecture  Structural constraints  Multiplicity  Cardinality  Participation  Connection traps.
CS 3630 Database Design and Implementation. Assignment 1 2 What is 3630?
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.
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
1 Entity-Relationship Model © Pearson Education Limited 1995, 2005.
Entity Relationship Modeling
Enhanced Entity-Relationship Modeling
1 Database Systems Entity Relationship (E-R) Modeling.
CSC271 Database Systems Lecture # 23. Summary: Previous Lecture  Database design using ER modeling  Concepts of ER model  Entities  Relationships.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 11 (2) CIS458 Sungchul Hong. Structural Constraints Main type of constraint on relationships is called multiplicity. Multiplicity - number (or.
DBMS ER model-2 Week 6-7.
Entity-Relationship Modeling. 2 Entity Type u Entity type –Group of objects with same properties, identified by enterprise as having an independent existence.
Chapter 8 Entity-Relationship Modeling Pearson Education © 2009.
Enhanced Entity-Relationship and UML Modeling. 2.
ENTITY-RELATIONSHIP MODELLING. Objectives: How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated with ER model.
Data Modeling Using the Entity- Relationship (ER) Model
Enhanced Entity-Relationship Modeling
Chapter # 3 Data Modeling Using the Entity-Relationship (ER) Model
Enhanced Entity-Relationship Modeling
COP Introduction to Database Structures
Conceptual Design & ERD Modelling
CS 3630 Database Design and Implementation
Enhanced ER Modeling Transparencies
Entity-Relationship Modeling
Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Enhanced Entity-Relationship Modeling Transparencies
Enhanced Entity-Relationship Modeling Transparencies
Enhanced Entity-Relationship Modeling
Chapter Entity-Relationship Modeling & Enhanced Entity- Relationship Modeling.
Enhanced Entity-Relationship Modeling
Enhanced Entity-Relationship Modeling
Presentation transcript:

Part3 Database Analysis and Design Techniques Chapter 05- Entity-Relationship Modeling Lu Wei College of Software and Microelectronics Northwestern Polytechnical University Database Systems

Lu Wei2 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei3 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei4 Introduction Once the requirements collection and analysis stage of the database application lifecycle is complete and we have documented the requirements for the database application, we are ready to begin the database design stage. One of the most difficult aspects of database design is the fact that designers, programmers, and end-users trend to view data and its use in different ways.

Lu Wei5 Introduction Unless we gain a common understanding that reflects how the enterprise operates, the design we produce will fail to meet the users’ requirements. To ensure that we get a precise understanding of the nature of the data and how it is used by the enterprise, a model is needed for communication

Lu Wei6 Introduction Requirements for the model –Non-technical –Free of ambiguities ( 无二义 ) The Entity-Relationship (ER) model is one such example. ER modeling is a top-down approach to database design. ER modeling is an important technique for any database designer to master.

Lu Wei7 Introduction The diagrammatic notations for representing ER model –Unified Modeling Language (UML) –The Crow’s Feet Notation –The Chen Notation The ER model provides a semi-formal notation that allows designers to create a high-level conceptual schema.

Lu Wei8 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei9 Entity and Entity Types Entity –An entity is an object in the real world that is uniquely identifiable and has independent existence. Entity Type –Entities having the same properties are grouped together to form an entity type. –Note that the convention is to use singular form for an entity type name. –Can be objects with a physical (or real) existence or conceptual existence.

Lu Wei10 Entity and Entity Types Examples Physical existence Staff Property Customer Student Conceptual existence Viewing Inspection SC

Lu Wei11 Entity and Entity Types Diagrammatic representation of entity types –Each entity type is shown as a rectangle labeled with the name of the entity, which is normally a singular noun. –The first letter of each word in entity name is upper case. StaffBranch

Lu Wei12 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei13 Relationship and Relationship Types Relationship –A relationship is a meaningful association between two or more entities. Relationship Type –A set of meaningful associations among entity types. –A relationship type is a grouping of similar relationships.

Lu Wei14 Relationship and Relationship Types About simantic net BranchHasStaff B003 B007 SG37 SG14 SA9

Lu Wei15 StudentElectCourse s001 s003 c01 c02 c03

Lu Wei16 Relationship and Relationship Types Diagrammatic representation of relationship types StaffBranch Has

Lu Wei17 Relationship and Relationship Types Degree of Relationship Type –The number of participating entity types in a relationship. The majority of the relationships in a database are binary.

Lu Wei18 Relationship and Relationship Types Diagrammatic representation of N-ary relationship types Client Registers Staff Branch Staff registers a client at a branch

Lu Wei19 Relationship and Relationship Types Title Group Publisher Collection

Lu Wei20 Relationship and Relationship Types Solicitor Arrangers Buyer Financial Institution Bid A buyer( 买主 ), advised by a solicitor( 法律顾问 ) and supported by a financial institution( 金融机构 ), places a bid( 投标 ).

Lu Wei21 Relationship and Relationship Types Questions –Is a ternary relationship is always equivalent and hence can be replaced with three binary relationships?

Lu Wei22 Relationship and Relationship Types Recursive Relationship –A relationship type where the same entity type participates more than once in different roles. Staff Supervises Supervisee Supervisor Student Supervises Supervisee Supervisor

Lu Wei23 Relationship and Relationship Types Two entities may be associated through more than one relationship. Role may be used. Staff Branch Has Manages Manager Branch Office Member of Staff

Lu Wei24 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei25 Attributes Attribute –A property of an entity or a relationship type. Attribute domain –The set of allowable values for one or more attributes. Simple (atomic) Attribute –Attribute composed of a single component with an independent existence. Composite Attribute –Attribute composed of multiple components, each with an independent existence.

Lu Wei26 Attributes Single-valued Attribute –Attribute that holds a single value for each occurrence of an entity type. Multi-valued Attribute –Attribute that holds multiple values for each occurrence of an entity type. Derived Attribute –Attribute that represents a value that is derivable from value of a related attribute, or set of attributes, not necessarily in the same entity type.

Lu Wei27 Attributes Candidate Key –Minimal set of attributes that uniquely identifies each occurrence of an entity type. Primary Key –Candidate key selected to uniquely identify each occurrence of an entity type. Composite Key –A candidate key that consists of two or more attributes.

Lu Wei28 Attributes Diagrammatic representation of attributes Staff staffNo{PK} name position salary /totalStaff Branch branchNo{PK} address street city postcode telNo[1..3] Has Manages

Lu Wei29 Attributes Attributes on Relationships Newspaper newspaperName PropertyForRent propertyNo Advertises dateAdvert cost Newspaper advertises property for rent

Lu Wei30 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei31 Strong and Weak Entity Types Strong Entity Type –Entity type that is not existence-dependent on some other entity type. Weak Entity Type –Entity type that is existence-dependent on some other entity type.

Lu Wei32 Strong and Weak Entity Types

Lu Wei33 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei34 Entity Type Schema –An entity type schema specifies the common structure shared by individual entities of that type. –Include a type name, name, and domain (value set) for each entity attribute, and constraints on entities.

Lu Wei35 Entity Type Schema Representation of entity type schema MemNo: 5-digits long integers DriverLic: State 2-letter abbreviation and a 10-digit integer separated by a blank Name: alphabetic string of length 30 containing blanks and hyphens Address: character string of length 50 PhoneNumber: character string of length 14

Lu Wei36 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei37 Structural Constraints There should be constraints placed on entity types that participate in a relationship. Do each branch must have staff? The constraints on relationships are used to express restrictions on relationships that exist in the real world. StaffBranch Has

Lu Wei38 Structural Constraints Main type of constraint on relationships is called multiplicity ( 多样性 ). Multiplicity –The number (or range) of possible occurrences of an entity type that may relate to a single occurrence of an associated entity type through a particular relationship. Represents policies (called business rules) established by user or company.

Lu Wei39 Structural Constraints In ER model, we can capture business rules using two types of multiplicity constraints, namely, cardinality ratio and participation.

Lu Wei40 Structural Constraints Cardinality ratio ( 基数约束 ) –Describes maximum number of possible relationship occurrences for an entity participating in a given relationship type. Participation ( 参与约束 ) –Determines whether all or only some entity occurrences participate in a relationship.

Lu Wei41 Structural Constraints The most common degree for relationships is binary. For cardinality constraint, binary relationships are generally referred to as being: –one-to-one (1:1) –one-to-many (1:*) –many-to-many (*:*) There are two types of participation constraints –Mandatory participation –Optional participation

Lu Wei42 Structural Constraints Examples

Lu Wei43 Structural Constraints Staff staffNo Branch branchNo Manages One branch is managed by one member of staff One member of staff manages one branch Cardinality Participation All branches are managed (mandatory) Not all staff manage branches (optional)

Lu Wei44 Structural Constraints Examples

Lu Wei45 Structural Constraints Staff staffNo PropertyForRent propertyNo Oversees *

Lu Wei46 Structural Constraints Examples

Lu Wei47 Structural Constraints Newspaper newspaperName PropertyForRent propertyNo Advertises 0..*1..*

Lu Wei48 Structural Constraints Multiplicity for Complex Relationships –Number (or range) of possible occurrences of an entity type in an n-ary relationship when other (n-1) values are fixed.

Lu Wei49 Structural Constraints Example

Lu Wei50 Structural Constraints StaffBranch Registers Client *

Lu Wei51 Structural Constraints Discuss about the multiplicity constraints between strong entity type and weak entity type. –A weak entity type must participate in a one-to-many relationship type with the identifying owner. –Weak entities have a total participation in the identifying owner relationship, and the identifying owner has a partial participation in the identifying owner relationship.

Lu Wei52 Structural Constraints Notation: –A total participation constraint does not imply that the corresponding participating entity type is a weak entity. –The requirements of the system determine the choice of strong entities versus weak entities versus multi- valued attributes.

Lu Wei53 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei54 Problems with ER Models Problems may arise when designing a conceptual data model called connection traps. Often due to a misinterpretation of the meaning of certain relationships. Two main types of connection traps are called fan traps and chasm traps.

Lu Wei55 Problems with ER Models Fan Trap –Where a model represents a relationship between entity types, but pathway between certain entity occurrences is ambiguous. Chasm Trap –Where a model suggests the existence of a relationship between entity types, but pathway does not exist between certain entity occurrences.

Lu Wei56 Problems with ER Models An Example of a Fan Trap StaffBranchDivision HasOperates * How to know which members of staff work at a particular branch

Lu Wei57 Problems with ER Models At which branch office does staff number SG37 work?

Lu Wei58 Problems with ER Models Restructuring ER model to remove Fan Trap StaffDivisionBranch HasOperates 1..* *1..1

Lu Wei59 Problems with ER Models SG37 works at branch B003.

Lu Wei60 Problems with ER Models An Example of a Chasm Trap BranchPropertyForRentStaff HasOversees * * How to know which properties are available at each branch?

Lu Wei61 Problems with ER Models At which branch office is property PA14 available?

Lu Wei62 Problems with ER Models Restructuring ER model to remove Chasm Trap BranchPropertyForRentStaff HasOversees * * Offers *

Lu Wei63 Problems with ER Models

Lu Wei64 Problems with ER Models Discuss –When a fan trap may exist? –When a chasm trap may occur? A fan trap may exist where two or more 1:* relationships fan out from the same entity. A chasm trap may occur where there are one or more relationships with a minimum multiplicity of zero (that is optional participation) forming part of the pathway between related entities.

Lu Wei65 Outline Introduction Entity and Entity Types Relationship and Relationship Types Attributes Strong and Weak Entity Types Entity Type Schema Structural Constraints Problems with ER Models Enhanced Entity-Relationship Modeling

Lu Wei66 Enhanced Entity-Relationship (EER) Modeling Since 1980s there has been an increase in emergence of new database applications with more demanding requirements. Basic concepts of ER modeling are not sufficient to represent requirements of newer, more complex applications. Response is development of additional ‘semantic’ modeling concepts.

Lu Wei67 Enhanced Entity-Relationship (EER) Modeling Semantic concepts are incorporated into the original ER model and called the Enhanced Entity-Relationship (EER) model. Examples of additional concept of EER model is called specialization / generalization.

Lu Wei68 Enhanced Entity-Relationship (EER) Modeling Specialization / Generalization –Superclass An entity type that includes one or more distinct subgroupings of its occurrences. –Subclass A distinct subgrouping of occurrences of an entity type.

Lu Wei69 Enhanced Entity-Relationship (EER) Modeling Specialization/generalization was introduced for two additional reasons: –To help in identifying the attributes and relationships specific to some entities, thereby enhancing the understanding of the application and adding more semantic clarity to the design. –To avoid specifying attributes to an entity not applicable to it. This eliminates the need for a great number of NULL values.

Lu Wei70 Enhanced Entity-Relationship (EER) Modeling Example Staff Branch Has Manages Manager Branch Office Member of Staff Staff Manager Sales secretary

Lu Wei71 Enhanced Entity-Relationship (EER) Modeling

Lu Wei72 Enhanced Entity-Relationship (EER) Modeling

Lu Wei73 Enhanced Entity-Relationship (EER) Modeling The relationship between supclasses and its subclasses –Attribute Inheritance An entity in a subclass represents same ‘real world’ object as in superclass, and may possess subclass-specific attributes, as well as those associated with the superclass. –Superclass/subclass relationship is one-to-one (1:1). –Not all members of a superclass need be a member of a subclass.

Lu Wei74 Enhanced Entity-Relationship (EER) Modeling The relationship between members of subclass –Superclass may contain overlapping or distinct subclasses.

Lu Wei75 Enhanced Entity-Relationship (EER) Modeling Constraints on Specialization / Generalization –Participation constraint Determines whether every member in superclass must participate as a member of a subclass. May be mandatory or optional. –Disjoint constraint Describes relationship between members of the subclasses and indicates whether member of a superclass can be a member of one, or more than one, subclass. May be disjoint or nondisjoint.

Lu Wei76 Enhanced Entity-Relationship (EER) Modeling There are four categories of constraints of specialization and generalization: –mandatory and disjoint –optional and disjoint –mandatory and nondisjoint –optional and nondisjoint.

Lu Wei77 Enhanced Entity-Relationship (EER) Modeling Diagrammatic representation of Specialization / Generalization

Lu Wei78 Enhanced Entity-Relationship (EER) Modeling

Lu Wei79 Enhanced Entity-Relationship (EER) Modeling Specialization –Process of maximizing differences between members of an entity by identifying their distinguishing characteristics. Generalization –Process of minimizing differences between entities by identifying their common characteristics.

Lu Wei80 Enhanced Entity-Relationship (EER) Modeling

Lu Wei81 Enhanced Entity-Relationship (EER) Modeling

Lu Wei82 Enhanced Entity-Relationship (EER) Modeling

Lu Wei83 Enhanced Entity-Relationship (EER) Modeling

Lu Wei84 Enhanced Entity-Relationship (EER) Modeling Aggregation

Lu Wei85 Enhanced Entity-Relationship (EER) Modeling Composition

Lu Wei86 Summary In this chapter you should have learned: –How to use Entity-Relationship (ER) modeling in a database design –The basic concepts associated with the Entity- Relationship (ER) model –A diagrammatic technique for displaying an ER model using the Unified Modeling Language (UML) or the Crow’s Feet Notation.

Lu Wei87 Summary –How to identify and resolve some problems with ER models –How to build an ER model from a requirements specification –The useful additional data modeling concepts of Enhanced ER (EER) model.