introduction to electronic government entity-relationship model tuesday, october 21, 2014

32
Entity-Relation Modeling Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International University of Japan

Upload: dmitri

Post on 05-Jan-2016

26 views

Category:

Documents


1 download

DESCRIPTION

Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014. Hun Myoung Park, Ph.D. Public Management & Policy Analysis Program Graduate School of International Relations. Layout. E-R Modeling Components of E-R Model Degree of a Relationship - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity-Relation Modeling

Hun Myoung Park, Ph.D.,

Public Management and Policy Analysis ProgramGraduate School of International Relations

International University of Japan

Page 2: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

OutlineBusiness RulesEntity-Relation ModelEntity of E-R ModelAttribute of E-R ModelRelationship of E-R ModelDegree of RelationshipCardinality of a RelationshipCASE Tools

2

Page 3: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014
Page 4: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Business Rules“A statement that defines or constrains

some aspect of the business”“Govern how data are handled and stored”“Derived from policies, procedures, events,

functions, and other business objects”“Documenting rules and policies of an

organization that govern data is exactly what data modeling is all about.”

4

Page 5: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity-Relationship ModelA database modeling method that

produces “a detailed, logical representation of the data”

Produces a conceptual schema in a relational database

Introduced by Peter Chen in 1976Represented by entity-relationship diagram

(ERD)

5

Page 6: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity-Relationship DiagramE-R diagram (ERD) represents the abstract

and conceptual relationships in ERM. Components of ERDoEntity with attributesoRelationship among entitiesoCardinality

6

Page 7: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity of E-R Model 1Represented by a rectangle or box in ERDName in uppercase Name as singular noun formIncludes a set of attributesEntity type versus entity instance

7

Page 8: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity of E-R Model 2Entity type is “a collection of entities that

share common properties”Entity instance is “a single occurrence of an

entity type”Strong (unique/independent) entity type

versus weak (dependent) entity type

8

Page 9: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Entity of E-R Model 3Associative entityAssociate the instances of entity typesContains attributes that are peculiar to the

relationship among the entity instances.Relationship in a rectangular with rounded

corners or dashed line

9

Page 10: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Strong Relationship 1A strong (identifying) relationship exists

“when the primary key of the related entity contains a primary key component of the parent entity” (p.331) It is represented by a solid line. The relationship between COURSE and CLASS tables below is strong because, Crs_code in CLASS (child entity in the 1:M relationship) inherits a primary key component from COURSE (parent entity).

10

Page 11: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Strong Relationship 2

11

Page 12: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Weak Relationship 1A weak (non-identifying) relationship exists

“if the primary key of the related entity does not contain a primary key component of the parent entity” (p.330). It is represented by a dashed line. In the following example, Crs_code in CLASS (child entity) is not a part of primary key and does not inherit a primary key component from COURSE (parent entity). Note that Crs_code in CLASS is a foreign key.

12

Page 13: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Weak Relationship 2

13

Page 14: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Attribute of E-R Model 1A property of an entity typeSingular none or none phraseSentence-casedRequired (must have values) in boldface

v.s. optional attribute (may not)

14

Page 15: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Attribute of E-R Model 2Simple (atomic) attribute v. s. composite

attribute (having meaningful components parts such as last name and first name) in (…)

Single-valued v.s. multi-valued attribute in {…}

Stored v.s. derived attribute (e.g., age calculated from date of birth) in […]

15

Page 16: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Relationship of E-R Model 1Connectivity (association) representing an

interaction among instances of entity types Relationship type is “a meaningful

association among entity types”Relationship instance is “an association

among entity instances

16

Page 17: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Relationship of E-R Model 2Represented by a diamond in the original

Chen notation and by a connecting lineConnectivity label (name) is a verb phrase

in sentence-caseEither an active or passive form (e.g.,

manages or managed by)

17

Page 18: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Degree of a Relationship 1The number of entity types that participate

in a relationship. Unary (recursive) relationship is a

relationship between the instances of one entity type

Examples are marriage and supervision in an organization

18

Page 19: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Degree of a Relationship 2Binary relationship is a relationship

between instances of two entity types.Binary relationship is most common Ternary relationship is a simultaneous

relationship among instances of three entity types.

19

Page 20: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014
Page 21: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Cardinality (Constraint) 1“The number of instances of entity B that

can (or must) be associated with each instance of entity A”

Cardinality of a relationship expresses the minimum and maximum number of entity occurrences associated with one occurrence of the related entity.

21

Page 22: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Cardinality (Constraint) 2Minimum cardinality: minimum number of

instances of entity B that may be associated with each instance of entity A

Maximum cardinality: maximum number of instances of entity B that may be associated with each instance of entity A

Zero (0) cardinality implies “optional,” cardinality one (1) means “mandatory”

22

Page 23: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

Cardinality (Constraint) 3(0,1) zero minimum or one maximum;

optional(1,1) one and only one; mandatory(0, N) one or many; optional(1,N) one or many; mandatorySymbols are used instead of numbers in

ERD

23

Page 24: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

24

Page 25: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

25

Page 26: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014
Page 27: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

CASE ToolsCASE tools are very useful in system design

and development stage, facilitating communications among stakeholders.

Professional CASE tools, CaseStudio, Microsoft Visio (Professional Edition)

MySql Workbenchhttp://dev.mysql.com/downloads/

workbench/

27

Page 28: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

An Example of CASE ToolsCASE Studio II and MySql WorkbenchGUI Provides flexible ways to modify.Define the database structure that matches

with the E-R diagramGenerate SQL commands to create

corresponding tables based on E-R diagram designed.

28

Page 29: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

E-R Diagram (CaseStudio 2)

Page 30: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

30

Page 31: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

31

Page 32: Introduction to Electronic Government Entity-Relationship Model Tuesday, October 21, 2014

32

ReferencesHoffer, Jeffrey A., V. Ramesh, and Heikki

Topi. 2011. Modern database management, 10th ed. Pearson Education.