Documente Academic
Documente Profesional
Documente Cultură
Objectives
n Definition
n List
of terms
n State
n Define
n Describe
n Transform
n Create
n Use
Logical Design
Physical Design
Database activity
logical database design
Implementation
Maintenance
Relation / table
nDefinition:
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
Referential integrity
constraints are
implemented with
foreign key to
primary key
references
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
(b) EMPLOYEE
relation with
recursive foreign key
(a) Bill-of-materials
relationships (M:N)
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
(Data Normalization)
nPrimarily
nThe
Well-Structured Relations
n A
n Goal
is to avoid anomalies
Question Is this a
relation?
n Anomalies
in this Table
Insertion
Deletion
Modification
n Candidate
Key:
nA
Normalization steps
Multivalued tabel
multivalued attributes
nEvery
nFig.
nFig.
nAll
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
38249
Brown
Thomas
1117804
FL
BRY123
15634
10/17/04
25
16017
11/13/04
15
14987
10/05/04
100
16293
11/18/04
15
17892
12/13/04
25
82453
Green
Sally
3911689
AL
TRE141
St_ID = student_ID
St_Lic = State_licence
Lic_no = License_number
Ticket# = Ticket_Number
Code = violation code
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
16017
11/13/04
15
82453
Green
Sally
3911689
AL
TRE141
14987
10/05/04
100
82453
Green
Sally
3911689
AL
TRE141
16293
11/18/04
15
82453
Green
Sally
3911689
AL
TRE141
17892
12/13/04
25
St_ID = student_ID
St_Lic = State_licence
Lic_no = License_number
Ticket# = Ticket_Number
Code = violation code
Ilustrasi
1 NF
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
Primary Key
Student_ID
Student_ Campus_
name
addres
Major
Partial
dependencies
Student_ID
Student_ Campus_
name
addres
Major
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Partial
dependencies
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Major
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Partial
dependencies
Attributes that functionally dependent
on Primary key
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Major
Partial
dependencies
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Full dependencies
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Major
Partial
dependencies
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Transitive
dependencies
Full dependencies
Partial
dependencies
Student_ID
Student_ Campus_
name
address
Major
Partial
dependencies
Course
_ID
Course
Title
Instructor_
name
Instructor
_location
Grade
Transitive
dependencies
Full dependencies
Student_ID
Course_ID
Student_ Campus_
name
address
Student_ID
Major
Course Title
3 NF
Instructor_name
Instructor_location
Grade
2 NF
Transitive
dependencies
2 NF
Student_ID
Student_name
Course_ID
Student_ID
Campus_address
3 NF
Major
3 NF
Grade
2 NF
Course_ID
Course Title
Instructor_name
Instructor_location
3 NF
Student_ID
Student_ Campus_
name
address
Course_ID
Student_ID
Course_ID
Major
Grade
Course Title
Course
Title
Instructor
_location
3 NF
PK
Student_ID
Instructor_
name
Student_ Campus_
name
address
3 NF
Major
FK
Course_ID
Student_ID
Grade
PK
Course_ID
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 ???