Top Banner
1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief http://arief.ismy.web.id
49

1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

Jan 03, 2016

Download

Documents

Clinton May
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

1

Chapter 11

Entity-Relationship ModelingTransparencies

Last Updated: 25 April 2011By M. Arief

http://arief.ismy.web.id

Page 2: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

2

Database Design

Approaches include:– Bottom-up

» Attributes Relation, Entities

– Top-down» Relation, Entities Attributes

– Inside-out» Attributes Major entities Other entities

– Mixed

http://arief.ismy.web.id

Page 3: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

3

Chapter 11 - Objectives

How to use Entity–Relationship (ER) modeling in database design.

Basic concepts associated with ER model.

Diagrammatic technique for displaying ER model using Unified Modeling Language (UML).

http://arief.ismy.web.id

Page 4: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

4

ER Diagram of Branch View of DreamHome

http://arief.ismy.web.id

Page 5: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

5

Concepts of the ER Model

Entity types

Relationship types

Attributes

http://arief.ismy.web.id

Page 6: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

6

Entity Type Entity type

– Group of “objects” with same properties, identified by enterprise as having an independent existence.

Object

- something that is or is capable of being seen, touched, or otherwise sensed, and about which users store data and associate behavior.

Entity occurrence– Uniquely identifiable object of an entity type.

http://arief.ismy.web.id

Page 7: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

7

Examples of Entity Types

http://arief.ismy.web.id

Page 8: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

8

Example of entity occurrence

Student ID Last Name First Name

2144 Arnold Betty

3122 Taylor John

3843 Simmons Lisa

9844 Macy Bill

2837 Leath Heather

2293 Wrench Tim

Entity occurrence

Entity: student

http://arief.ismy.web.id

Page 9: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

9

ER Diagram of Staff and Branch Entity Types

UML: First letter of each word is in upper caseEx. PropertyForRent

http://arief.ismy.web.id

Page 10: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

10

Relationship Types

Relationship type– Set of meaningful associations among entity

types.

Relationship occurrence– Uniquely identifiable association, which

includes one occurrence from each participating entity type.

http://arief.ismy.web.id

Page 11: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

11

Semantic Net of Has Relationship Type

http://arief.ismy.web.id

Page 12: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

12

ER Diagram of Branch Has Staff Relationship

UML: - First letter of each word is in upper case Ex. LeasedBy

- Use arrow symbolhttp://arief.ismy.web.id

Page 13: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

13

Relationship Types

Degree of a Relationship– Number of participating entities in relationship.

Relationship of degree:– two is binary;– three is ternary;– four is quaternary.

http://arief.ismy.web.id

Page 14: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

14

Binary Relationship called POwns

http://arief.ismy.web.id

Page 15: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

15

Ternary Relationship called Registers

Other example: Project, Location, Employee, Assignment

http://arief.ismy.web.id

Page 16: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

16

Quaternary Relationship called Arranges

http://arief.ismy.web.id

Page 17: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

17

Relationship Types

Recursive Relationship– Relationship type where same entity type

participates more than once in different roles unary relationship.

Relationships may be given role names to indicate purpose that each participating entity type plays in a relationship.

http://arief.ismy.web.id

Page 18: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

18

Recursive Relationship called Supervises with Role Names

http://arief.ismy.web.id

Page 19: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

19

Other example of Recursive Relationship

http://arief.ismy.web.id

Page 20: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

20

Entities associated through two distinct Relationships with Role Names

http://arief.ismy.web.id

Page 21: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

21

Attributes

Attribute– Property of an entity or a relationship type.

» UML: first letter of first word is in lower case, first letter of other words is in upper case

Attribute Domain– Set of allowable values for one or more

attributes.

http://arief.ismy.web.id

Page 22: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

22

Attributes

Simple Attribute– Attribute composed of a single component

with an independent existence.» Ex. position, salary

Composite Attribute– Attribute composed of multiple components,

each with an independent existence.» Ex. address: street+city+postcode

http://arief.ismy.web.id

Page 23: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

23

Attributes

Single-valued Attribute– Attribute that holds a single value for each

occurrence of an entity type. » Ex. branchNo

Multi-valued Attribute– Attribute that holds multiple values for each

occurrence of an entity type. » Ex. UML: telNo [1..3]

http://arief.ismy.web.id

Page 24: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

24

Attributes

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.

» Ex. /leasedDuration= rentStart – rentFinish

UML: /totalSalary, /totalStaff

http://arief.ismy.web.id

Page 25: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

25

Keys 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. » UML: branchNo {PK}

Composite Key– A candidate key that consists of two or more

attributes. » Ex. Advert(propertyNo, newspaperName, dateAdvert, cost)

Composite key: propertyNo+newspaperName,+dateAdverthttp://arief.ismy.web.id

Page 26: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

26

ER Diagram of Staff and Branch Entities and their Attributes

http://arief.ismy.web.id

Page 27: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

27

Entity Type Strong Entity Type (parent)

– Entity type that is not existence-dependent on some other entity type.

OR

– Each participating entity has its own independent primary key.

Weak Entity Type (child)

– Entity type that is existence-dependent on some other entity type.

OR

– The parent entity’ key is also part of the primary key of the child entity.http://arief.ismy.web.id

Page 28: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

28

Strong Entity Type called Client and Weak Entity Type called Preference

http://arief.ismy.web.id

Page 29: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

29

Strong and Weak Entity

Weak Entity

Strong Entity

http://arief.ismy.web.id

Page 30: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

30

Strong and Weak Entity

http://arief.ismy.web.id

Page 31: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

31

Relationship called Advertises with Attributes

Indicate that that the relationship conceals unidentified entity typehttp://arief.ismy.web.id

Page 32: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

32

Structural Constraints

Main type of constraint on relationships is called multiplicity.

Multiplicity - 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.

http://arief.ismy.web.id

Page 33: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

33

Structural Constraints

The most common degree for relationships is binary.

Binary relationships are generally referred to as being:– one-to-one (1:1)– one-to-many (1:*)– many-to-many (*:*)

http://arief.ismy.web.id

Page 34: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

34

Semantic Net of Staff Manages Branch Relationship Type

http://arief.ismy.web.id

Page 35: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

35

Multiplicity of Staff Manages Branch (1:1) Relationship Type

http://arief.ismy.web.id

Page 36: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

36

Semantic Net of Staff Oversees PropertyForRent Relationship Type

http://arief.ismy.web.id

Page 37: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

37

Multiplicity of Staff Oversees PropertyForRent (1:*) Relationship Type

http://arief.ismy.web.id

Page 38: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

38

Semantic Net of Newspaper Advertises PropertyForRent Relationship Type

http://arief.ismy.web.id

Page 39: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

39

Multiplicity of Newspaper Advertises PropertyForRent (*:*) Relationship

http://arief.ismy.web.id

Page 40: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

40

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.

http://arief.ismy.web.id

Page 41: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

41

Semantic Net of Ternary Registers Relationship with Values for Staff and Branch Entities Fixed

http://arief.ismy.web.id

Page 42: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

42

CR56/B003

CR57/B003

CR62/B003

CR84/B003

CR91/B003

r1

r2

r3

r4

r5

SG37

SG5

SG14

http://arief.ismy.web.id

Page 43: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

43

Multiplicity of Ternary Registers Relationship

http://arief.ismy.web.id

Page 44: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

44

Summary of Multiplicity Constraints

http://arief.ismy.web.id

Page 45: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

45

Structural Constraints Multiplicity is made up of two types of restrictions on

relationships: cardinality and participation.

Cardinality – 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.

http://arief.ismy.web.id

Page 46: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

46

Multiplicity as Cardinality and Participation Constraints

http://arief.ismy.web.id

Page 47: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

47

http://arief.ismy.web.id

Page 48: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

48

http://arief.ismy.web.id

Page 49: 1 Chapter 11 Entity-Relationship Modeling Transparencies Last Updated: 25 April 2011 By M. Arief .

49

Introduction to the UML

Unified Modeling Language (UML) – a set of modeling conventions that is used to specify or describe a software system in terms of objects.

– The UML does not prescribe a method for developing systems—only a notation that is now widely accepted as a standard for object modeling.

http://arief.ismy.web.id