Data World: Represents A Real World Which Is Changing Continuously
Data World: Represents A Real World Which Is Changing Continuously
Data World: Represents A Real World Which Is Changing Continuously
- Database represents a real world which is changing continuously - Data model is the procedure for representing a real world
3 Data Worlds
infornation modeling
entity set attributes values
data modeling
record type field values
real world(reality)
2-1
database design
conceptual world
real world
data structuring
data modeling
2-2
2-4
consistency
stored database physical, low-level model logical, representational model (logical data structure)
2-5
E-R Model
- by Peter Chen, 1976 - based on a perception of real world which consists of a set of basic objects called entities and relationships among these objects - E-R diagram is graphical database structure in E-R model which is consist of entity set, relationship, attribute and link
Entity - an object that exists and is distinguishable from other objects - ex) Yoon S. A. with social security number 700123-1684321 - may be abstract, such as a holiday or a concept
2-6
2-9
Example
2 - 10
Dept
. .
2 - 11
Teachers
- many-to-many : no restriction
export
Countries
Products
2 - 12
2 - 13
Account
dominant, strong 462-21-23 262-45-20 645-44-09 ... 3,000 6,000 5,000
Log
Transaction
subordinate, weak 1 4 7 11 Oct 1996 12 Oct 1996 12 Oct 1996 ... +50 +350 - 150
2 - 14
Keys
it is important to be able to discriminate how entities and relationships Superkey - a set of one or more attribute wich allow us to identify uniquely an entity in the entity set - may have unnecessary attributes to distinct Candidate Key - minimal superkey Primary Key - a candidate key chosen by the DB designer
2 - 15
E-R Diagram
graphical database structure in E-R model - rectangle : (strong) entity set - double rectangle : weak entity set - ellipse : attribute - diamond : relationship set - line : (1) link attribute to entity set (2) link entity set to relationship set
2 - 16
2 - 17
Account
Log
Transaction
(1)
(2)
(3)
2 - 18
Generalization
There are similarities between the checking-account entity set and the saving-account entity set in the sense that they have several attribute in common. This commonality can be expressed by generalization.
- Creation method : create a high-level entity set from two or more lower level entity set's common attributes - Usage : is used to emphasize the similarities among lower level entity type and to hide their differences - Inheritance : lower level entity set (saving-account and checking account) inherit the attributes of higher level entity set (account)
2 - 19
Generalization (cont'd)
account number account balance
saving-account is an account
savingaccount
checkingaccount
account number
interestrete
overdraftamount
balance
2 - 20
Generalization (cont'd)
Transforming E-R diagram including generalization to
tabular form
(1) Primary key of high-level entity set plus lower level entity sets account + savings-account, checking-account
(2) Only lower level entity sets savings-account, checking-account (including higher-level attributes)
2 - 21
Aggregation
One limitation of the E-R model is that is not possible to express relationship among relationships - Aggregation is an abstraction through which relationships are treated as high-level entities hospital
1
hospitalization
m
doctor
2 - 22
treatment
patients
2 - 23
lecturer
2 - 24
C100 Database 3
prerequisite subject C99
BrncAcct
2 - 28
155 62
Lee Hanbat Taejon 402 100 408 300 Namsan 2,000,000 Ulsan
2 - 29
2 - 31
2 - 32
2 - 33
2 - 34
2 - 35
2 - 36
2 - 37
Balance
A#
2 - 38
instantiation
Account object : all 6% : $1000 -> 5% $1000 -> 6% pay-interest Balance 5000 A# 100
2 - 40