Beruflich Dokumente
Kultur Dokumente
Objectives
Define terms
List five properties of relations
State two properties of candidate keys
Define first, second, and third normal form
Describe problems from merging relations
Transform E-R and EER diagrams to
relations
Create tables with entity and relational
integrity constraints
Use normalization to convert anomalous
tables to well-structured relations
Chapter 4
Relation
Chapter 4
Key Fields
Chapter 4
Figure 4-3 Schema for four relations (Pine Valley Furniture Comp
Primary Key
Foreign Key
(implements 1:N relationship
between customer and order)
Chapter 4
Integrity Constraints
Domain Constraints
Entity Integrity
Action Assertions
Chapter 4
Chapter 4
Integrity Constraints
Chapter 4
Figure 4-5
Referential integrity constraints (Pine Valley Furniture)
Referential
integrity
constraints are
drawn via arrows
from dependent to
parent table
Chapter 4
10
Referential
integrity
constraints are
implemented with
foreign key to
primary key
references
Chapter 4
11
2.
3.
Chapter 4
12
Chapter 4
13
Chapter 4
14
15
Partial
16
Chapter 4
17
Chapter 4
18
Chapter 4
19
Foreign key
Chapter 4
20
21
Foreign key
Foreign key
Chapter 4
New
intersection
relation
22
Chapter 4
23
24
Identifier Assigned
It
25
Chapter 4
26
27
Chapter 4
28
Chapter 4
29
Chapter 4
30
(a) EMPLOYEE
entity with unary
relationship
(b)
EMPLOYEE
relation with
recursive
foreign key
Chapter 4
31
Chapter 4
32
33
Chapter 4
34
Remember
that the
primary key
MUST be
unique
Chapter 4
This is why
treatment date
and time are
included in the
composite
primary key
It would be
better to create a
surrogate key
like Treatment#
35
Transforming EER
Diagrams into Relations
(cont.)
Chapter 4
36
Chapter 4
37
Figure 4-21
Mapping supertype/subtype relationships to relations
38
Data Normalization
avoid unnecessary
duplication of data
Chapter 4
39
Well-Structured Relations
40
ExampleFigure 4-2b
Chapter 4
41
42
Chapter 4
43
44
Chapter 4
45
46
47
48
Chapter 4
49
50
Getting it into
Second Normal
Form
51
Chapter 4
52
Getting it into
Third Normal
Form
Chapter 4
53
Merging Relations
Chapter 4
54
Enterprise Keys
Primary keys that are unique in the whole
database, not just within a single relation
Corresponds with the concept of an
object ID in object-oriented systems
Chapter 4
55
b) Sample data
with enterprise
key
Chapter 4
56
Chapter 4
57