14
Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

Embed Size (px)

Citation preview

Page 1: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

Databases : Database Building Procedures

2007, Fall

Pusan National University

Ki-Joune Li

Page 2: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

2

STEMPNU

Importance of Database

Application of Databases

Garbage-In Garbage-OutGarbage-In Garbage-Out

About 70% of Development Cost for Information System: DB CostAbout 70% of Development Cost for Information System: DB Cost

Page 3: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

3

STEMPNU

Comparison with Software Lifecycle

Requirement Analysis

Functional Specification

Design

Development Environments

Coding

Test

Maintenance

Software Life Cycle – Waterfall Model

Requirement Analysis

Modeling

Schema Design

DB Environments

Data Collection and Input

Quality Control

Maintenance

DB Life Cycle

Page 4: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

4

STEMPNU

Requirement Analysis

Analysis of Status as it is and as it shall be.

Output of Analysis Use-Case Diagram of UML: Workflow Analysis Data items that have been maintained and to be maintained Description of each item: Data Dictionary Relationships and Constraints on items Required Correctness

Example: Spatial Correctness, Temporal Correctness

Current State: As it is As it must be

Page 5: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

5

STEMPNU

Data Dictionary

Definitions and Representation of Data Items such as Precise definition of data elements Integrity constraints or Constrains Stored procedures and trigger rules Specification of

Producer and Consumer of data element

Why it is so important? Common understanding on data items Consistency of databases Important input to data modeling

Page 6: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

6

STEMPNU

Data Modeling

Data Modeling Understanding the real world and application A very small piece of the real world

According to viewpoint Determined by applications

Drawing what you have understood in formal method Class Diagram in UML

4 steps Definition of Entities Attributes of each Entity Relationships Constraints

Page 7: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

7

STEMPNU

Class Diagram: Basic

DVD Movie VHS Movie Video Game

Rental Item{abstract}

Rental Invoice

1..*1

Customer

Checkout Screen

0..1

1

Simple

Association

Class

Abstract

Class

Simple

Aggregation

Generalization

Composition

(Dependency)

Multiplicity

MyClassName

+SomePublicAttribute : SomeType

-SomePrivateAttribute : SomeType

#SomeProtectedAttribute : SomeType

+ClassMethodOne()

+ClassMethodTwo()

Responsibilities

-- can optionally be described here.

Page 8: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

8

STEMPNU

Extract nouns from Problem statement Use-Case Diagram

Delete unnecessary entities Duplication Attributes rather than entity

ex. Loan amount

Definition of Features Geographic Entity Granularity

Definition of Entities

MyClassName

Page 9: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

9

STEMPNU

Definition of Attributes

Attributes of Entity Description of Entity

Photo Images, Names, and etc.. Values

Accuracy Level Different Levels of Detail (LOD)

MyClassName

+SomePublicAttribute : SomeType

-SomePrivateAttribute : SomeType

#SomeProtectedAttribute : SomeType

Page 10: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

10

STEMPNU

Relationship

Relationship Relationship between entities Relationship may have its attributes

Example: Male marriage Femalemarriage:

Page 11: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

11

STEMPNU

Constraints

Conditions Entity must respect Relationship must respect

Example Doctor Operation Patient

Doctor.Major = “Surgeon”

Page 12: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

12

STEMPNU

Schema Design

Automatic Conversion from Data Modeling to Schema

Check Points: Performance Issues Materialization Index

Based on Workload Analysis Distribution of operations Distribution of values

Page 13: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

13

STEMPNU

Materialization

In SQL, view is a virtual table derived from a Select statement Eample

CREATE VIEW ExcellentStudents ASSELECT Name, Department, ScoreFROM StudentsWHERE Score > 4.0

SELCT NameFROM ExcellentStudentsWhere Department=‘CS’

Invoke

ExcellentStudents

Materialization

Page 14: Databases : Database Building Procedures 2007, Fall Pusan National University Ki-Joune Li

14

STEMPNU

Materialize or Not ?

Materialization Duplication

Not 3NF (BCNF): to be discussed at the end of this course Cause an inconsistency between the original and derived tables Update: Overhead due to update propagation

Extra Space Requirements

Should be determined depending on the WORKLOAD Frequency of updates Cost for update propagation

Especially when materialized view is geographically distributed