Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding.

Similar presentations


Presentation on theme: "Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding."— Presentation transcript:

1 Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding Entity Relationship Diagrams

2 Slide 2Chapter 5: Understanding Entity Relationship Diagrams Outline  Notation basics  Understanding relationships  Generalization hierarchies  Business rule representation  Diagram rules  Alternative notations

3 Slide 3Chapter 5: Understanding Entity Relationship Diagrams Basic Symbols

4 Slide 4Chapter 5: Understanding Entity Relationship Diagrams Cardinalities

5 Slide 5Chapter 5: Understanding Entity Relationship Diagrams Cardinality Notation

6 Slide 6Chapter 5: Understanding Entity Relationship Diagrams Classification of Cardinalities  Minimum cardinality based  Mandatory: existence dependent  Optional  Maximum cardinality based  Functional  1-M  M-N  1-1

7 Slide 7Chapter 5: Understanding Entity Relationship Diagrams Summary of Cardinalities

8 Slide 8Chapter 5: Understanding Entity Relationship Diagrams Optional Relationship Example

9 Slide 9Chapter 5: Understanding Entity Relationship Diagrams More Relationship Examples

10 Slide 10Chapter 5: Understanding Entity Relationship Diagrams Comparison to Access Notation

11 Slide 11Chapter 5: Understanding Entity Relationship Diagrams Understanding Relationships  Identification dependency  M-N relationships with attributes  Self identifying relationships  M-way relationships  Equivalence between M-N and 1-M relationships

12 Slide 12Chapter 5: Understanding Entity Relationship Diagrams Identification Dependency

13 Slide 13Chapter 5: Understanding Entity Relationship Diagrams M-N Relationships with Attributes

14 Slide 14Chapter 5: Understanding Entity Relationship Diagrams M-N Relationships with Attributes (II)

15 Slide 15Chapter 5: Understanding Entity Relationship Diagrams Instance Diagrams for Self- Referencing Relationships

16 Slide 16Chapter 5: Understanding Entity Relationship Diagrams ERD Notation for Self- Referencing Relationships

17 Slide 17Chapter 5: Understanding Entity Relationship Diagrams Associative Entity Types for M-way Relationships

18 Slide 18Chapter 5: Understanding Entity Relationship Diagrams Relationship Equivalence  Replace M-N relationship  Associative entity type  Two identifying 1-M relationships  M-N relationship versus associative entity type  Largely preference  Associative entity type is more flexible in some situations

19 Slide 19Chapter 5: Understanding Entity Relationship Diagrams Associative Entity Type Example

20 Slide 20Chapter 5: Understanding Entity Relationship Diagrams Generalization Hierarchies

21 Slide 21Chapter 5: Understanding Entity Relationship Diagrams Inheritance  Subtypes inherit attributes of supertypes (direct and indirect)  Allows abbreviation of attribute list  Applies to code (methods) as well as attributes (data)

22 Slide 22Chapter 5: Understanding Entity Relationship Diagrams Generalization Constraints

23 Slide 23Chapter 5: Understanding Entity Relationship Diagrams Multiple Levels of Generalization

24 Slide 24Chapter 5: Understanding Entity Relationship Diagrams Comprehensive Example

25 Slide 25Chapter 5: Understanding Entity Relationship Diagrams Business Rules  Enforce organizational policies  Promote efficient communication  Formal representation in ERD  Informal representation in documentation associated with an ERD  Use rules language to formally represent in relational database after conversion

26 Slide 26Chapter 5: Understanding Entity Relationship Diagrams Formal Representation  Primary key constraints: entity identification  Named relationships: direct connections among business entities  Identification dependency: knowledge of other entities for identification  Cardinalities: restrict number of related entities in a business situation  Generalization hierarchies: classification of business entities and organizational policies

27 Slide 27Chapter 5: Understanding Entity Relationship Diagrams Informal Representation  Specify as documentation associated with elements of an ERD  Candidate key constraints: alternate ways to identify business entities  Reasonable values: fixed collection of values or consistent with another attribute  Null value constraints: data collection completeness  Default values: simplify data entry and provide value when unknown

28 Slide 28Chapter 5: Understanding Entity Relationship Diagrams Diagram Rules  Ensure that ERD notation is correctly used  Similar to syntax rules for a computer language  Completeness rules: no missing specifications  Consistency rules: no conflicts among specifications

29 Slide 29Chapter 5: Understanding Entity Relationship Diagrams Completeness Rules  Primary Key Rule: all entity types have a PK (direct, indirect, or inherited)  Naming Rule: all entity types, relationships, and attributes have a name  Cardinality Rule: cardinality is specified in both directions for each relationship  Entity Participation Rule: all entity types participate in an at least one relationship except for entity types in a generalization hierarchy  Generalization Hierarchy Participation Rule: at least one entity type in a generalization hierarchy participates in a relationship

30 Slide 30Chapter 5: Understanding Entity Relationship Diagrams Primary Key Rule Issue  Primary key rule is simple in most cases  For some weak entities, the PK rule is subtle  Weak entity with only one 1-M identifying relationship  Weak entity must have a local key to augment the borrowed PK from the parent entity type  Violation of PK rule if local key is missing

31 Slide 31Chapter 5: Understanding Entity Relationship Diagrams PK Rule Violation Example

32 Slide 32Chapter 5: Understanding Entity Relationship Diagrams Naming Consistency Rules  Entity Name Rule: entity type names must be unique  Attribute Name Rule: attribute names must be unique within each entity type and relationship  Inherited Attribute Rule: attribute names in a subtype do not match inherited (direct or indirect) attribute names.

33 Slide 33Chapter 5: Understanding Entity Relationship Diagrams Relationship Names  No uniqueness requirement  Participating entities provide a context for relationship names  Use unique names as much as possible to distinguish relationships  Must provide unique names for multiple relationships between the same entity types

34 Slide 34Chapter 5: Understanding Entity Relationship Diagrams Connection Consistency Rules  Relationship/Entity Connection Rule: relationships connect two entity types (not necessarily distinct)  Relationship/Relationship Connection Rule: relationships are not connected to other relationships  Redundant Foreign Key Rule: foreign keys are not used.

35 Slide 35Chapter 5: Understanding Entity Relationship Diagrams Identification Dependency Rules  Weak entity rule: weak entities have at least one identifying relationship  Identifying relationship rule: at least one participating entity type must be weak for each identifying relationship  Identification dependency cardinality rule: the minimum and maximum cardinality must equal 1 for a weak entity in all identifying relationships

36 Slide 36Chapter 5: Understanding Entity Relationship Diagrams Example of Diagram Errors

37 Slide 37Chapter 5: Understanding Entity Relationship Diagrams Corrected ERD

38 Slide 38Chapter 5: Understanding Entity Relationship Diagrams Support in the ER Assistant  Relationship formation rules are supported by diagram construction  Other rules are supported by the Check Diagram feature  For the Redundant Foreign Key rule, the ER Assistant detects FKs that have the same name as the associated PKs

39 Slide 39Chapter 5: Understanding Entity Relationship Diagrams ERD Variations  No standard ERD notation  Symbol variations  Placement of cardinality symbols  Rule variations  Be prepared to adjust to the ERD notation in use by each employer

40 Slide 40Chapter 5: Understanding Entity Relationship Diagrams ERD Rule Variations  Lack of ERD standards  M-way relationships  M-N relationships  Relationships with attributes  Self-referencing relationships  Relationships connected to other relationships  Adapt to notations in work environments

41 Slide 41Chapter 5: Understanding Entity Relationship Diagrams Chen ERD Notation

42 Slide 42Chapter 5: Understanding Entity Relationship Diagrams Aqua Data Studio  Supports a variety of DBMSs through query and DBA tools  Data modeling tool  Similar appearance as Crow’s Foot notation used in the textbook  Some relational model notation  Several levels of diagram detail  Manipulate ERD regions (subsets) to reduce complexity

43 Slide 43Chapter 5: Understanding Entity Relationship Diagrams Aqua Data Studio Example

44 Slide 44Chapter 5: Understanding Entity Relationship Diagrams ADS Generalization Example

45 Slide 45Chapter 5: Understanding Entity Relationship Diagrams Unified Modeling Language  Standard notation for object-oriented modeling  Objects  Object features  Interactions among objects  UML supports class diagrams, interface diagrams, and interaction diagrams  More complex than ERD notation

46 Slide 46Chapter 5: Understanding Entity Relationship Diagrams Simple Class Diagram

47 Slide 47Chapter 5: Understanding Entity Relationship Diagrams Association Class

48 Slide 48Chapter 5: Understanding Entity Relationship Diagrams Generalization Relationship

49 Slide 49Chapter 5: Understanding Entity Relationship Diagrams Composition Relationship

50 Slide 50Chapter 5: Understanding Entity Relationship Diagrams Summary  Data modeling is an important skill  Crow’s Foot ERD notation is widely used  Use notation precisely  Use the diagram rules to ensure structural consistency and completeness  Understanding the ERD notation is a prerequisite to applying the notation on business problems


Download ppt "Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding."

Similar presentations


Ads by Google