Download presentation
Presentation is loading. Please wait.
Published byMolly White Modified over 8 years ago
1
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع الاساسي للمادة هي الكتاب المعتمد في وصف المقرر
2
Copyright © 2011Ramez Elmasri and Shamkant B. Navathe Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model
3
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 3 Chapter Outline Constraints on Relationships ER Diagrams - Notation ER Diagram for COMPANY Schema Alternative Notations – UML class diagrams, others
4
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 4 Example Attribute of a Relationship Type: Hours of WORKS_ON
5
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 5 Constraints on Relationships Relationship types usually have certain constraints that limit the possible combinations of entities that may participate in the corresponding relationship set These constraints are determined from the mini-world situation that the relationships represent Two main type of relationship constraints Also known as ratio constraints Cardinality Ratio Participation Constraint (also called existence dependency constraint )
6
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Participation Constraints Determines weather the existence of an entity depends upon its being related to another entity through the relationship Also called Existence Dependency Constraint This constraints specifies the minimum number of relationship instances that each entity can participate in Two types of participation constraints Total Participation one or more (mandatory participation, existence-dependent) Partial Participation zero (optional participation, not existence-dependent) Chapter 3-6
7
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Total Participation Every employee must work for a department Then an employee entity can exist only if it participates in at least one WORKS-FOR relationship Thus, the participation of employee in WORKS- FOR relationship is called total participation Which means that, every entity in the total set of employee entity type must be related to a department entity type via WORKS-FOR relationship It is called also existence dependency or mandatory In ER diagram, it is represented as a double line Chapter 3-7
8
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Total Participation Example Chapter 3-8 e 1 e 2 e 3 e 4 r1r2r3R4r1r2r3R4 d 1 d 2
9
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Partial Participation Means that, part of the set of entities are related to some entity via relationship, but not necessarily all Is called also optional participation or not existence-dependent For example, not every employee manage a department, so the participation of employee in the MANAGE relationship is partial In ER diagram, it is represented as a single line Chapter 3-9
10
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Partial Participation Example Chapter 3-10 e 1 e 2 e 3 e 4 R1R2R1R2 d 1 d 2 11
11
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 11 Recursive Relationship Type is: SUPERVISION (participation role names are shown)
12
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 12 Attributes of Relationship types A relationship type can have attributes: For example, Hours Per Week of WORKS_ON Its value for each relationship instance describes the number of hours per week that an EMPLOYEE works on a PROJECT. A value of HoursPerWeek depends on a particular (employee, project) combination Start Date of MANAGES Its value for each relationship instance describes the starting date that an EMPLOYEE manage a DEPARTMENT. A value of Start_date depends on a particular (employee, department) combination
13
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 13 Example Attribute of a Relationship Type: Hours of WORKS_ON
14
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Alternative (min, max) notation for relationship structural constraints: Specified on each participation of an entity type E in a relationship type R Specifies that each entity e in E participates in at least min and at most max relationship instances in R Default(no constraint): min=0, max=n (signifying no limit) Must have min max, min 0, max 1 Derived from the knowledge of mini-world constraints In This method Min = 0 implies partial participation Min > 0 implies total participation Slide 3- 14
15
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Min, Max Example: A department has exactly one manager and an employee can manage at most one department. Specify (0,1) for participation of EMPLOYEE in MANAGES Specify (1,1) for participation of DEPARTMENT in MANAGES Slide 3- 15 (1,1) (0,1) l Suppose we have 10 employees and 3 departments l The others 7 employees does not participate 1 1
16
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Min, Max Example An employee can work for exactly one department but a department can have any number of employees. Specify (1,1) for participation of EMPLOYEE in WORKS_FOR Specify (1,N) for participation of DEPARTMENT in WORKS_FOR Slide 3- 16 (1,N) (1,1) N 1
17
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 17 COMPANY ER Schema Diagram using (min, max) notation
18
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 18 Relationships of Higher Degree Relationship types of degree 2 are called binary Relationship types of degree 3 are called ternary and of degree n are called n-ary
19
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Ternary Relationship The ternary relationship set SUPPLY is a set of relationship instances (S,J, P) S is a SUPPLIER who is currently supplying a PART P to a PROJECT J Slide 3- 19
20
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 20 Summary of notation for ER diagrams
21
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 21 Alternative diagrammatic notation ER diagrams is one popular example for displaying database schemas Many other notations exist in the literature and in various database design and modeling tools Appendix A illustrates some of the alternative notations that have been used UML class diagrams is representative of another way of displaying ER concepts that is used in several commercial design tools
22
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 22 UML class diagrams Represent classes (similar to entity types) as large rounded boxes with three sections: Top section includes entity type (class) name Second section includes attributes Third section includes class operations (operations are not in basic ER model) Relationships (called associations) represented as lines connecting the classes Other UML terminology also differs from ER terminology Used in database design and object-oriented software design UML has many other types of diagrams for software design (see Chapter 12)
23
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 23 UML class diagram for COMPANY database schema
24
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 24 Data Modeling Tools A number of popular tools that cover conceptual modeling and mapping into relational schema design. Examples: ERWin, S- Designer (Enterprise Application Suite), ER- Studio, etc. POSITIVES: Serves as documentation of application requirements, easy user interface - mostly graphics editor support NEGATIVES: Most tools lack a proper distinct notation for relationships with relationship attributes Mostly represent a relational design in a diagrammatic form rather than a conceptual ER-based design (See Chapter 12 for details)
25
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 25 Some of the Currently Available Automated Database Design Tools COMPANYTOOLFUNCTIONALITY Embarcadero Technologies ER StudioDatabase Modeling in ER and IDEF1X DB ArtisanDatabase administration, space and security management OracleDeveloper 2000/Designer 2000Database modeling, application development Popkin Software System Architect 2001Data modeling, object modeling, process modeling, structured analysis/design Platinum (Computer Associates) Enterprise Modeling Suite: Erwin, BPWin, Paradigm Plus Data, process, and business component modeling Persistence Inc. PwertierMapping from O-O to relational model Rational (IBM)Rational RoseUML Modeling & application generation in C++/JAVA Resolution Ltd.XcaseConceptual modeling up to code maintenance SybaseEnterprise Application SuiteData modeling, business logic modeling VisioVisio EnterpriseData modeling, design/reengineering Visual Basic/C++
26
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 26 Extended Entity-Relationship (EER) Model (in next chapter) The entity relationship model in its original form did not support the specialization and generalization abstractions Next chapter illustrates how the ER model can be extended with Type-subtype and set-subset relationships Specialization/Generalization Hierarchies Notation to display them in EER diagrams
27
Copyright © 2011 Ramez Elmasr and Shamkant B. Navathei Slide 3- 27 Chapter Summary ER Model Concepts: Entities, attributes, relationships Constraints in the ER model Using ER in step-by-step conceptual schema design for the COMPANY database ER Diagrams - Notation Alternative Notations – UML class diagrams, others
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.