Professional Documents
Culture Documents
Logical Database
Design and the
Relational Model
n Definition
n List
of terms
n State
n Define
n Describe
n Transform
Zaldy Adrianto
n Create
zaldy.adrianto@unpad.ac.id
n Use
Relation / table
Project Identification
and Selection
nDefinition:
Logical Design
Physical Design
Database activity
logical database design
Implementation
Maintenance
n Rows
n Columns
n NOTE:
Key Fields
Keys
Primary
Foreign
Primary Key
Integrity Constraints
n Domain
Constraints
n Allowable
n Entity
Integrity
n No
n Action
Assertions
n Business
Integrity Constraints
n
Referential Integrity rule that states that any foreign key value
(on the relation of the many side) MUST match a primary key value
in the relation of the one side. (Or the foreign key can be null)
nFor
Referential integrity
constraints are drawn
via arrows from
dependent to parent
table
Binary Relationships
nOne-to-Many
nMany-to-Many
nOne-to-One
Foreign key
Foreign key
Foreign key
New
intersection
relation
Associative Entities
nIdentifier
Not Assigned
nDefault
nIdentifier
nIt
Assigned
nDefault
Unary Relationships
nOne-to-Many
same relation
nMany-to-Many
nOne
- Two relations:
nOne
(a) Bill-of-materials
relationships (M:N)
(b) EMPLOYEE
relation with
recursive foreign key
Supertype/Subtype Relationships
n Supertype
n Subtype
n 1:1
Figure 5-21:
Mapping Supertype/subtype relationships to relations
These are
implemented as oneto-one relationships
Data
Normalization
Normalisasi Data
Well-Structured Relations
(Data Normalization)
nPrimarily
n A
n Goal
is to avoid anomalies
nThe
Question Is this a
relation?
in this Table
Insertion
Deletion
Modification
n Candidate
Key:
nA
Normalization steps
Multivalued tabel
nEvery
nFig.
nFig.
nAll
multivalued attributes
1NF
Every
No
Partial
n 2NF
n Note:
n Solution:
Merging Relations
n View
n Issues
n Homonyms
meanings
n Transitive
n Supertype/subtype
to merging
Enterprise Keys
nPrimary
nCorresponds
L-Name
F-Name
Phone
Number
St_Lic
Lic_No
Ticket#
Date
Code
Fine
St_ID
L-Name
F-Name
Phone
Number
St_Lic
Lic_No
Ticket#
Date
Code
Fine
38249
Brown
Thomas
1117804
FL
BRY123
15634
10/17/04
25
38249
Brown
Thomas
1117804
FL
BRY123
15634
10/17/04
25
16017
11/13/04
15
38249
Brown
Thomas
1117804
FL
BRY123
16017
11/13/04
15
14987
10/05/04
100
82453
Green
Sally
3911689
AL
TRE141
14987
10/05/04
100
16293
11/18/04
15
82453
Green
Sally
3911689
AL
TRE141
16293
11/18/04
15
17892
12/13/04
25
82453
Green
Sally
3911689
AL
TRE141
17892
12/13/04
25
82453
Green
Sally
3911689
AL
TRE141
St_ID = student_ID
St_ID = student_ID
St_Lic = State_licence
St_Lic = State_licence
Lic_no = License_number
Lic_no = License_number
Ticket# = Ticket_Number
Ticket# = Ticket_Number
1 NF
Ilustrasi
Student_ID
Student_
name
Campus_a
ddres
Major
Course_I
D
Course
Title
168300458
Williams
208 Brooks
IS
IS 350
Database
MGT
Codd
B 104
268300458
IS
IS 465
System
Analysis
Parsons
B 317
IS 350
Database
MGT
Codd
B 104
Fund
Acct 201 Accountin
g
Miller
H 310
543291073
Baker
104
Phillips
Acct
543291073
Baker
104
Phillips
Acct
543291073
Baker
104
Phillips
Acct
Instructor_n Instructor_l
ame
ocation
Grade
Mktg
300
Intro
Mrktg
Bennet
B 212
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Partial
dependencies
Primary Key
Student_ID
Student_ Campus_
name
addres
Major
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Student_ID
Student_ Campus_
name
addres
Major
Partial
dependencies
Partial
dependencies
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Major
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Partial
dependencies
Attributes that functionally dependent
on Primary key
Grade
Student_ID
Student_ Campus_
name
address
Major
Partial
dependencies
Course
_ID
Course
Title
Instructor_
name
Full dependencies
Instructor
_location
Grade
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Partial
dependencies
Course
_ID
Major
Course
Title
Instructor_
name
Partial
dependencies
Instructor
_location
Grade
Transitive
dependencies
Student_ID
Student_ Campus_
name
address
Partial
dependencies
Course
_ID
Major
Course
Title
Instructor_
name
Instructor
_location
Grade
Transitive
dependencies
Full dependencies
Full dependencies
2 NF
Student_ID
Course_ID
Student_ Campus_
name
address
Student_ID
3 NF
Major
Course Title
Instructor_name
Student_ID
Instructor_location
Grade
Student_name
Course_ID
Student_ID
Campus_address
3 NF
Student_ID
Student_ Campus_
name
address
2 NF
Course_ID
Course Title
Student_ID
Instructor_name
Instructor_location
3 NF
PK
Major
Student_ Campus_
name
address
3 NF
Major
FK
Course_ID
Student_ID
Course_ID
Grade
Student_ID
Grade
PK
Course_ID
Course Title
Course
Title
Course_ID
Instructor_
name
Instructor
_location
3 NF
3 NF
Grade
2 NF
Transitive
dependencies
Major
Course Title
Course
Title
Instructor_
name
Instructor
_location
External schema
Conceptual Schema
Internal Schema
Logical Schema
Relational Data Model (need
normalization when anomalies occurs)
Physical Schema
Questions ???