Upload
jemima-francis
View
214
Download
0
Embed Size (px)
Citation preview
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
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
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
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
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
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.
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
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
10
STEMPNU
Relationship
Relationship Relationship between entities Relationship may have its attributes
Example: Male marriage Femalemarriage:
11
STEMPNU
Constraints
Conditions Entity must respect Relationship must respect
Example Doctor Operation Patient
Doctor.Major = “Surgeon”
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
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
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