Data Modeling and Database Design
Data Modeling and Database Design
Data Modeling and Database Design
DATABASE DESIGN
Part 3
Objectives
• Translate Logical to Physical design
• Steps for converting (mapping) Resolved
ERD to set of Table Instance Charts
• Table Instance Charts symbols.
• Some mapping examples
Database Design -
from Logical to Physical
• Map entities and attributes to tables and
columns respectively.
• Naming conventions should be consistent.
• Consider primary, unique and foreign keys
and check constraints as well
• Additional requirements
– Design the indexes
– Establish view definitions
– Plan the physical storage space
Steps to convert your Resolved
ERD to TIC set
• Map ENTITIES to TABLES
• Map ATTRIBUTES to COLUMNS
• Map * to NOT NULL constraints
• Map UIDs to PRIMARY KEY constraints
• Map (#) Secondary UIDs to NOT NULL and
UNIQUE Constraints
• Map RELATIONSHIPS to FKs
Table Instance Chart Symbols
• PK - Primary Key
• FK - Foreign Key
• FK1, FK1 - Composite Foreign Keys
• FK1, FK2 - Two foreign keys related to two
separate tables
• NN - Not Null
• U - Unique
• U1, U1 - Two columns unique in
EMPLOYEE_NEW_FORCE Table
* per_diem_rate
performs requires
EMPLOYEE_NEW_FORCE ACTIVITY
# emp_no # activity_id
* position *
o job_description description
* salary o start_date
o commission o end_date
* internal
Entities to tables
EMPLOYEE_NEW_FORCE ACTIVITY
EMPLOYEE_ACTIVITY
ACTIVITY
Attributes to Columns
Column Name id description start_date end_date internal
Key
Type
Nulls/
Uniques
FK Ref
Table
FK Column
Datatype
MAX Length
Validation
UID to PK and * to NOT NULL
ACTIVITY
Column Name id description start_date end_date internal
Key
Type PK
Nulls/
Uniques NN NN
FK Ref
Table
FK Column
Datatype
MAX Length
Validation
If Entity on Many side, then add FK Column
ACTIVITY
Column Name id description start_date end_date internal
Key
Type PK
Nulls/
Uniques NN NN NN
FK Ref
Table
FK Column
Datatype
MAX Length
Validation
FK Ref
Table
FK Column
Datatype
MAX Length
Validation >= sysdate {Y,N}
LINK - INTERSECTION
ENTITIES
for EMPLOYEE_ for
ACTIVITY
PK and NN
EMPLOYEE_ACTIVITY
Column Name emp_no activity_id per_diem_rate
Key
Type PK PK
Nulls/
Uniques NN
FK Ref
Table
FK ref
Column
Datatype
MAX
Length
Foreign
EMPLOYEE_ACTIVITY
Keys
Column Name emp_no activity_id per_diem_rate
Key
Type PK, FK1 PK, FK2
Nulls/
Uniques NN
FK ref
Column emp_no activity_id