36
Modelling Methodologies Chapter 16, 17, 18

Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Embed Size (px)

Citation preview

Page 1: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modelling Methodologies

Chapter 16, 17, 18

Page 2: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 2

Database Design

Physical DB design

LogicalDB design

ConceptualDB design

Hardware dependentSoftware dependent

Hardware independentSoftware dependent

Hardware independentSoftware independent

Page 3: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 44

Design Methodology Overview

Step 1 Build conceptual data model.

Step 2 Build and validate logical data model.

Step 3 Translate logical data model for target DBMS.

Step 4 Design file organizations and indexes.

Step 5 Design user views.

Step 6 Design security mechanisms.

Step 7 Consider the introduction of controlled redundancy.

Step 8 Monitor and tune the operational system.

ConceptualDB design

LogicalDB design

Physical DB design

Page 4: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 5

Database Design

Physical DB design

LogicalDB design

ConceptualDB design

Hardware dependentSoftware dependent

Hardware independentSoftware dependent

Hardware independentSoftware independent

Page 5: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 6

Step 1 Build Conceptual Data Model for Each View

Objective: To build a conceptual data model of an enterprise for each specific view.

Step 1.1 Identify entity types

Objective: To identify the main entity types that are required by the view;

Document entity types in data dictionary.

Entity Name Description Aliases Occurrence

Staff General term describing all staff Employee Each member of staff works at one particular

branch

employed by DearmHome Each property has a single owner & is available at

PropertyForRent General term describing all Property one specific branch, where the property is managed

property for rent by 1 member of staff. A property is viewed by

many clients and rented by a single client at a time

Data Dictionary for Staff View Showing Description of Entities

Page 6: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 7

Step 1 Build Conceptual Data Model for Each View

Step 1.2 Identify relationship types

Objective: To identify the important relationships that exist between the entity types

that have been identified.

Page 7: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 8

ERD for Staff View of DreamHome

Page 8: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 9

Step 1 Build Conceptual Data Model for Each View

Entity Name Multiplicity Relationship Entity Name Multiplicity

Staff 0..1 Manages PropertyForRent 0..100

0..1 Supervises Staff 0..10

PropertyForRent 1..1 AssociatedWith Lease 0..*

Data Dictionary for Staff View Showing Description of Relationships

Page 9: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 10

Step 1 Build Conceptual Data Model for Each View

Step 1.3 Identify and associate attributes with entity or relationship types

Objective: To identify and associate attributes with the appropriate entity or relationship

types and document the details of each attribute.

Step 1.4 Determine attribute domains

Objective: To determine domains for the attributes in the data model and document the details of each domain.

Page 10: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 11

Step 1 Build Conceptual Data Model for Each View

Entity Attribute Description Data Length Nulls Multi- Default Range PK CKName Type Valued Value

Staff StaffNo Uniquely identifies a staff member varchar 5 No No Y Y name

FName First name of Staff varchar 15 No No

Lname Last name of Staff varchar 15 No No

position Job title of member of staff varchar 10 No No

sex Gender of member of staff character 1 Yes No M F, M

DOB Date of Birth of member of staff Date Yes No 1960-1990

Data Dictionary for Staff View Showing Description of Attributes

Page 11: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 12

Step 1 Build Conceptual Data Model for Each View

Step 1.5 Determine candidate and primary key attributes

Objective: To identify the candidate key(s) for each entity and if there is more than one

candidate key, to choose one to be the primary key.

Page 12: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 13

ERD for Staff View of DreamHome with PK

Page 13: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 14

Step 1 Build Conceptual Data Model for Each View

Step 1.6 Consider use of enhanced modeling concepts

Objective: To consider the use of enhanced modeling concepts, such as specialization

/ generalization, aggregation, and composition.

Page 14: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 15

ERD for Staff View of DreamHome with specialization / generalization

Page 15: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 16

Step 1 Build Conceptual Data Model for Each View

Step 1.7 Check model for redundancy

Objective: To check for the presence of any redundancy in the model.

1. Re-examine 1:1 relationships.

2. Remove redundant relationships.

Step 1.8 Validate conceptual model against user transactions

Objective: To ensure that the conceptual model supports the transactions required by the view. Describe the transaction.Use transaction pathways: diagrammatically represent the pathway taken by each transaction on the ERD.

Page 16: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 17

Using transaction’s Pathways

Page 17: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 18

Step 1 Build Conceptual Data Model for Each View

Step1.9 Review conceptual data model with user

Objective: To review the conceptual data model with the user to ensure that the model is a ‘true’ representation of the user’s view of the enterprise.

Page 18: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 19

Database Design

Physical DB design

LogicalDB design

ConceptualDB design

Hardware dependentSoftware dependent

Hardware independentSoftware dependent

Hardware independentSoftware independent

Page 19: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 21

Step 2 Build and Validate Logical Data Model

Step 2.1 Derive relations for logical data model

Step 2.2 Validate relations using normalization

Step 2.3 Validate relations against user transactions

Step 2.4 Define integrity constraints

Step 2.5 Review logical data model with user

Step 2.6 Merge logical data models into global model (optional step)

Step 2.6.1 Merge local logical data models into global model

Step 2.6.2 Validate global logical data model

Step 2.6.3 Review global logical data model with users

Step 2.7 Check for future growth

Page 20: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 24

Referential Integrity Constraints for Relations

Page 21: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 2727

Step 2.6.1 Merge logical data models into global model (optional step)

1. Review the names & contents of entities/relations and their CK.

2. Review the names & contents of relationships/FK.

3. Merge entities/relations from the local data models.

4. Include (without merging) entities/relations unique to each local data model.

5. Merge relationships/FK from the local data models.

6. Include (without merging) relationships/FKs unique to each local data model.

7. Check the missing entities/relations and relationships/FKs.

8. Check FKs.

9. Check integrity constraints.

10. Draw the global ER/relation diagram.

11. Update the documentation.

Page 22: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 28

1. Review the names & contents of entities/relations and their CK

Branch View Entity Type CK

Branch BranchNo PostCodeTelephone TelNoStaff StaffNoManager StaffNoPrivateOwner OwnerNoBusinessOwner Bname telNoClient ClientNoPropertyForRent PropertynoLease LeaseNo PropertyNo RentStart ClientNo, RentStart

Staff View Entity Type CK

Staff StaffNo

PrivateOwner OwnerNoBusinessOwner Bname telNo OwnerNoClient ClientNoPropertyForRent PropertynoViewing ClientNo, PropertyNo

Page 23: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 29

2. Review the names & contents of relationships/FK

Branch View FK Relationship

mgrStaffNo -> Manager(StaffNo) Manages

branchN -> Branch(branchNo)

supervisorStaffNo -> Staff(staffNo) Supervisor

branchNo -> Branch(branchNo)

StaffNo -> Staff(StaffNo)

OwnerNo -> PrivateOwner(ownerNo) Owns

OwnerNo -> Owns

BusinessOwner(ownerNo)

StaffNo -> Staff(StaffNo) Oversees

BranchNo -> Branch(BranchNo) Offers

Staff View FK Relationship

Relation

Branch

Telephone

Staff

Manager

PrivateOwner

BusinessOwner

Client

PropertyForRent

Viewing

supervisorStaffNo -> Staff(staffNo) Supervisor

StaffNo -> Staff(StaffNo) Registers

OwnerNo -> PrivateOwner(ownerNo) POwns

OwnerNo -> BOwns

BusinessOwner(ownerNo)

StaffNo -> Staff(StaffNo) Manages

Page 24: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 30

3. Merge entities/relations from the local data models

Merge entities/relations with the same name & the same PK.

Branch View Staff View

PRIVATE OWNER(Ono, name, address) PRIVATE OWNER(Ono, fname, lname, address)

Global View

PRIVATE OWNER(Ono, fname, lname, address)

Page 25: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 31

3. Merge entities/relations from the local data models

Merge entities/relations with the same name but different PK.

Branch View Staff View

BOWNER(bName, bType, address,telNO) BOWNER(Ono, bName, bType, address,telNo)

AK telNo AK bName, telNo

Global View

BOWNER(Ono, bName, bType, address)

AK bName, telNo

Page 26: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

34

Relations for the Branch user views of DreamHome

Pearson Education © 2009

Page 27: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

35

Relations that represent the global logical data model for

DreamHome

Pearson Education © 2009

Page 28: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

36

Global relation diagram for DreamHome

Pearson Education © 2009

Page 29: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

37

Step 2.7 Check for future growth

Objective: To determine whether there are any significant changes likely in the foreseeable future and to assess whether the global logical data model can accommodate these changes.

Pearson Education © 2009

Page 30: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 38

Database Design

Physical DB design

LogicalDB design

ConceptualDB design

Hardware dependentSoftware dependent

Hardware independentSoftware dependent

Hardware independentSoftware independent

Page 31: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 3939

Comparison of Logical and Physical Database Design

Logical database design is concerned with the what,

Physical database design is concerned with the how.

Process of producing a description of the implementation of the database on

secondary storage; it describes the base relations, file organizations, and

indexes used to achieve efficient access to the data, and any associated integrity

constraints and security measures.

Physical DB Design

Page 32: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 40

Overview of Physical Database Design

MethodologyStep 3 Translate logical data model for target DBMS

Step 3.1 Design base relations

Step 3.2 Design representation of derived data

Step 3.3 Design general constraints

Step 4 Design physical representation

Step 4.1 Analyze transactions

Step 4.2 Choose file organizations

Step 4.3 Choose indexes

Step 4.4 Estimate disk space requirements

Step 5 Design user views

Step 6 Design security mechanisms

Step 7 Consider the introduction of controlled redundancy

Step 8 Monitor and tune the operational system

Page 33: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 42

Step 3.1 Design Base Relations

Objective: To decide how to represent base relations identified in logical model.

- For each relation, need to define:

the name of the relation;

a list of simple attributes in brackets;

the PK and, where appropriate, AKs and FKs.

referential integrity constraints for any FKs identified.

- For each attribute, need to define:

its domain, consisting of a data type, length, and any constraints on the domain;

an optional default value for the attribute;

whether the attribute can hold nulls.

whether it is derived, and if so, how it should be computed.

Page 34: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 4343

PropertyForRent Relation

Page 35: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

Modeling Methodologies 44

Step 3.2 Design Representation of Derived Data

Objective: To decide how to represent any derived data present in the global logical data model in the target DBMS.

Derived attribute can be stored in database or calculated every time it is needed. Option selected is based on:

additional cost to store the derived data and keep it consistent with operational data from which it is derived;

cost to calculate it each time it is required.

Page 36: Modelling Methodologies Chapter 16, 17, 18. Modeling Methodologies2 Database Design Physical DB design Logical DB design Conceptual DB design Hardware

45

PropertyforRent Relation and Staff Relation with

Derived Attribute noOfProperties

Pearson Education © 2009