1  High-level conceptual model  Used for the conceptual design of DB applications  Many DB design tools employs its concepts  Chen 1976 -- MIT “The.

Slides:



Advertisements
Similar presentations
Database Modeling: Methods, Techniques, and Symbols
Advertisements

Conceptual Data Modeling: ER
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 3- 1.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
4/17/2017.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
CS 405G Introduction to Database Systems
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Data Modeling Using the Entity-Relationship (ER) Model CS 340: Introduction to Databases.
Topic 3 Data Modeling Using the Entity-Relationship (ER) Model
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.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
Entities and Attributes
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Data Modeling Using the Entity-Relationship (ER) Model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
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.
Slide 3- 1 Notation for Constraints on Relationships Cardinality ratio (of a binary relationship): 1:1, 1:N, N:1, or M:N Shown by placing appropriate numbers.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
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:
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
EER Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Conceptual Modeling and Database Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Many-to-many (M:N) RELATIONSHIP e 1 e 2 e 3 e 4 e 5 e 6 e 7 r1r2r3r4r5r6r7r1r2r3r4r5r6r7 p 1 p 2 p 3 r8r8 r9r9.
Database Systems Background Review (2) Dr. Muhammad Shafique
Database Systems Conceptual to Relational Modeling II Lecture # 11 Feb 25 th 2011.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 3- 1.
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 2 Modeling using the Concepts of Data Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2016 Ramez Elmasr and Shamkant B. Navathei CHAPTER 3 Data Modeling Using the Entity-Relationship (ER) Model Slide 1- 1.
Data Modeling Using the Entity-Relationship (ER) Model
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 17 July 28,2012 Data Modeling using the Entity Relationship.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model تنبيه :
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship (ER) Model
Databases (CS507) CHAPTER 7.
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
Entity- Relationship (ER) Model
Chapter 3 Data Modeling Using the Entity-Relationship Model
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity- Relationship Model
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
Data Modeling Using the Entity-Relationship (ER) Model
Presentation transcript:

1  High-level conceptual model  Used for the conceptual design of DB applications  Many DB design tools employs its concepts  Chen MIT “The Entity Relationshipodel -- Toward a Unified View of Data” ACM - TODS Chapter 7 Data Modeling Using the Entity- Relationship Model

p 432

3 Overview of Database Design Process  Two main activities: Database design Applications design  Focus in this chapter on database design To design the conceptual schema for a database application  Applications design focuses on the programs and interfaces that access the database Generally considered part of software engineering

4 Entities, Attributes  Entity - a ”thing” in the real world with independent existence  Attribute - properties that describe the entity Simple (atomic) vs. composite Single-values vs. multivalued Stored vs. derived Null values Complex Attributes {AddressPhone({Phone(areacode,phonenumber)}, Address(StreetAddress(Number,Street,AptNumber),City,State,Zip))}

5

6

7 Entity Types, Entity Set, Keys, and Value Sets  Entity Types: Defines a collection (or set) of entities that have the same attributes e.g. employee, student  Entity Set: The collections of all entities of a particular entity type e.g. employee = set of all employees  Value Sets: specifies the set of values assigned to attribute (domain of values)

8

9

10

11

12

13  1) Existence Dependency X and Y are entities Y entity cannot exist without X entity  Y cannot enter the database unless its corresponding X is there  if X is dropped from the database, Y must be dropped as well X = strong, parent, owner, dominant Y = weak, child, dependent, subordinate Dependencies

14 Weak Entity Types  An entity that does not have a key attribute  A weak entity must participate in an identifying relationship type with an owner or identifying entity type  Entities are identified by the combination of: A partial key of the weak entity type The particular entity they are related to in the identifying entity type  Example: A DEPENDENT entity is identified by the dependent’s first name, and the specific EMPLOYEE with whom the dependent is related Name of DEPENDENT is the partial key DEPENDENT is a weak entity type EMPLOYEE is its identifying entity type via the identifying relationship type DEPENDENT_OF

15  2) Identifier Dependency Occurs when the weak entity set does not have a candidate key, and its instances are indistinguishable w/o a relationship with other entity (e.g. grade).  3) Referential Dependency Occurs when a weak entity contains a foreign key of the corresponding strong entity (e.g. essn in Dependent table)  Referential Constraint  A nonnull value of the foreign key attribute in the entity instance must always equal the value of the primary key of an associated strong entity instance.

16

17 Many-to-one (N:1) Relationship

18 Many-to-many (M:N) Relationship

19 Displaying a recursive relationship  In a recursive relationship type. Both participations are same entity type in different roles. For example, SUPERVISION relationships between EMPLOYEE (in role of supervisor or boss) and (another) EMPLOYEE (in role of subordinate or worker).  In following figure, first role participation labeled with 1 and second role participation labeled with 2.  In ER diagram, need to display role names to distinguish participations.

20 A Recursive Relationship Supervision`

21 Recursive Relationship Type is: SUPERVISION (participation role names are shown)

22 Notation for Constraints on Relationships  Cardinality ratio (of a binary relationship): 1:1, 1:N, N:1, or M:N Shown by placing appropriate numbers on the relationship edges.  Participation constraint (on each participating entity type): total (called existence dependency) or partial. Total shown by double line, partial by single line.  NOTE: These are easy to specify for Binary Relationship Types.

23 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  Examples: 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 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 (0,n) for participation of DEPARTMENT in WORKS_FOR

24 The (min,max) notation for relationship constraints Read the min,max numbers next to the entity type and looking away from the entity type

25 COMPANY ER Schema Diagram using (min, max) notation

26 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  Unified Modeling Language ( UML) class diagrams is representative of another way of displaying ER concepts that is used in several commercial design tools

27 Summary of notation for ER diagrams

28 Unified Modeling Language ( 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)

29 UML class diagram for COMPANY database schema

30 Other alternative diagrammatic notations

31 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  In general, an n-ary relationship is not equivalent to n binary relationships  Constraints are harder to specify for higher- degree relationships (n > 2) than for binary relationships

32 Discussion of n-ary relationships (n > 2)  In general, 3 binary relationships can represent different information than a single ternary relationship (see Figure 3.17a and b on next slide)  If needed, the binary and n-ary relationships can all be included in the schema design (see Figure 3.17a and b, where all relationships convey different meanings)  In some cases, a ternary relationship can be represented as a weak entity if the data model allows a weak entity type to have multiple identifying relationships (and hence multiple owner entity types) (see Figure 3.17c)

33 Example of a ternary relationship

34 Discussion of n-ary relationships (n > 2)  If a particular binary relationship can be derived from a higher-degree relationship at all times, then it is redundant  For example, the TAUGHT_DURING binary relationship in Figure 3.18 (see next slide) can be derived from the ternary relationship OFFERS (based on the meaning of the relationships)

35 Another example of a ternary relationship

36 Displaying constraints on higher-degree relationships  The (min, max) constraints can be displayed on the edges – however, they do not fully describe the constraints  Displaying a 1, M, or N indicates additional constraints An M or N indicates no constraint A 1 indicates that an entity can participate in at most one relationship instance that has a particular combination of the other participating entities  In general, both (min, max) and 1, M, or N are needed to describe fully the constraints

37 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)

38 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 2000 Database 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++

39 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

40 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

41 Mapping an E-R Model to a Relational Model  1) The entity sets represented by rectangles becomes relations represented by tables  2) For strong entity sets, attributes represented by ovals become attributes of the relations or column headings of the table For weak entity set - all attributes include all the attributes of the weak entity, plus the primary key of the owner entity  3) The table for a relationship set has column headings consisting of the associated entities, plus column for descriptive attributes if any

42 Examples  mpo.gc.ca/meds/Prog_Nat/NCIS/Definitio n/Ncis_ER_diagram.gif mpo.gc.ca/meds/Prog_Nat/NCIS/Definitio n/Ncis_ER_diagram.gif

43

44

45 Data Modeling Tools - Visio 2007  Visio 2007 Demo: Show It Like It Is -- Connect Data to Your Visio Diagram This demo shows how you can use Microsoft Office Visio Professional 2007 to analyze how a process or other area is actually performing by connecting data to the shapes in your diagram. 1/30/2008 Visio 2007 Demo: Create a background and watermark for your drawings Learn how to create a background and watermark for your drawings in Microsoft Office Visio /25/2008 Visio 2007 Demo: Let Data Tell Its Story with Data Graphics In this demo, you’ll see how to use data graphics in your Microsoft Office Visio 2007 diagram to present the right data in the right way and to make your points clearly.1/30/2008 Visio 2007 Demo: Show It Like It Is -- Connect Data to Your Visio Diagram Visio 2007 Demo: Create a background and watermark for your drawings Visio 2007 Demo: Let Data Tell Its Story with Data Graphics  Visio 2007 Demo: Give Your Diagram a Makeover by Applying a Theme Use themes in Microsoft Office Visio Professional 2007 to easily add color and style to your diagram and create an attractive, engaging piece. 1/30/2008 Visio 2007 Demo: Get a New Perspective on Data with PivotDiagrams In this demo, you’ll see how PivotDiagrams can help you get a fresh perspective on your data. Visio 2007 Demo: Give Your Diagram a Makeover by Applying a Theme Visio 2007 Demo: Get a New Perspective on Data with PivotDiagrams

46 Oracle Designer – Oracle Designer  ts/designer/demos.htm ts/designer/demos.htm Database Design and Generation  Creating Entity Diagrams (Viewlet)Viewlet  Creating Database Designs (Viewlet)Viewlet  Working With Server Models (Viewlet)Viewlet  Generating Databases (Viewlet)Viewlet  Capturing Database Designs (Viewlet)Viewlet

47 Data Modeling Tools Sybase – PowerDesigner  er/demonstrationvideos er/demonstrationvideos  Database Designers the technical video demonstrates: A Walk Through of a Sample Conceptual Data Model Reverse Engineer a PDM from a Database Iterative Bi-level Design with PowerDesigner Keeping the Modeling and the Servers Synchronized Download this video: ba1.exe ba1.exe