尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Chapter 13 Normalization
Review Questions
13.1 Describe the purpose of normalizing data.
When we design a database for a relational system, the main objective in
developing a logical data model is to create an accurate representation of the
data, its relationships and constraints. To achieve this objective, we must identify
a suitable set of relations. A technique that we can use to help identify such
relations is called normalization. Normalization is a technique for producing a set
of relations with desirable properties, given the data requirements of an
enterprise. Normalization supports database designers by presenting a series of
tests, which can be applied to individual relations so that a relational schema can
be normalized to a specific form to prevent the possible occurrence of update
anomalies.
See also Sections 13.1 and 13.4.
13.2 Describe the types of update anomalies that may occur on a relation that has
redundant data.
A major aim of relational database design is to group attributes into relations so
as to minimize information redundancy and thereby reduce the file storage space
required by the base relations. Another serious difficulty using relations that have
redundant information is the problem of update anomalies. These can be
classified as insertion, deletion, or modification anomalies.
See Section 13.2
13.3 Describe the concept of functional dependency.
Functional dependency describes the relationship between attributes in a relation.
For example, if A and B are attributes of relation R, B is functionally dependent
on A (denoted A → B), if each value of A in R is associated with exactly one
value of B in R.
Functional dependency is a property of the meaning or semantics of the attributes in a relation.
The semantics indicate how the attributes relate to one another and specify the functional
dependencies between attributes. When a functional dependency is present, the dependency is
specified as a constraint between the attributes.
See also Section 13.3.
13.4 How is the concept of functional dependency associated with the process of
normalization?
Normalization is a formal technique for analyzing relations based on their
primary key (or candidate keys in the case of BCNF) and functional
dependencies. Normalization is often performed as a series of tests on a relation
to determine whether it satisfies or violates the requirements of a given normal
form. Three normal forms were initially proposed, which are called first (1NF),
second (2NF) and third (3NF) normal form. Subsequently, a stronger definition
of third normal form was introduced and is referred to as Boyce-Codd normal
form (BCNF). All of these normal forms are based on the functional
dependencies among the attributes of a relation.
13.4 What are the main characteristics of functional dependencies that are used
when normalizing a relation?
The main characteristics of functional dependencies that we use in
normalization (see Section 13.3.1):
• have a one-to-one relationship between attribute(s) on the left and right-
hand side of a dependency;
• hold for all time;
• are nontrivial.
13.5 Describe how a database designer typically identifies the set of functional
dependencies associated with a relation.
Normally, the database designer starts by specifying functional dependencies
that are semantically obvious; however, there are usually numerous other
functional dependencies. In fact, the task of specifying all possible functional
dependencies for ‘real’ database projects is more often than not, impractical.
To begin to identify the set of functional dependencies F for a relation,
typically first identify the dependencies that are determined from the semantics
of the attributes of the relation. Then, apply Armstrong’s axioms (Rules 1 to 3)
to infer additional functional dependencies that are also true for that relation.
A systematic way to determine these additional functional dependencies is to
first determine each set of attributes A that appears on the left-hand side of
some functional dependencies and then to determine the set of all attributes
that are dependent on A. Thus, for each set of attributes A we can determine
the set A+
of attributes that are functionally determined by A based on F; (A+
is
called the closure of A under F).
13.6 Describe Armstrong’s axioms.
Armstrong’s axioms specify how new functional dependencies can be
inferred from given ones. Let A, B, and C be subsets of the attributes of the
relation R. Armstrong’s axioms are as follows:
1. Reflexivity: If B is a subset of A, then A → B
2. Augmentation : If A → B, then A,C → Β,C
3. Transitivity: If A → B and B → C, then A → C
2
Database Systems: Instructor’s Guide - Part III
13.7 Describe the characteristics of a table in unnormalized form (UNF) and
describe how such a table is converted to a first normal form (1NF) relation.
A table in unnormalized form contains one or more repeating groups. To convert
to first normal form (1NF) either remove the repeating group to a new relation
along with a copy of the original key attribute(s), or remove the repeating group
by entering appropriate data in the empty columns of rows containing the
repeating data (see Section 13.5).
13.8 What is the minimal normal form that a relation must satisfy? Provide a
definition for this normal form.
Minimal normal form is 1NF: a relation in which the intersection of
each row and column contains one and only one value (see Section 13.5).
13.9 Describe the two approaches to converting a first normal form (1NF) relation
to second normal form (2NF) relation(s).
The normalization of 1NF relations to 2NF involves the removal of partial
dependencies. If a partial dependency exists, we remove the functionally
dependent attributes from the relation by placing them in a new relation along
with a copy of their determinant (see Section 13.6.2).
13.10 Describe the concept of full functional dependency and describe how this
concept relates to 2NF. Provide an example to illustrate your answer.
Full functional dependency Indicates that if A and B are attributes of a
relation, B is fully functionally dependent on A if B is functionally dependent
on A, but not on any proper subset of A.
Second Normal Form (2NF) is a relation that is in first normal form and every
non-primary-key attribute is fully functionally dependent on the primary key.
13.11 Describe the concept of transitive dependency and describe how this concept
relates to 3NF. Provide an example to illustrate your answer.
Transitive dependency A condition where A, B, and C are attributes
of a relation such that if A → B and B → C, then C is transitively dependent
on A via B (provided that A is not functionally dependent on B or C)
Third Normal Form (3NF) is a relation that is in first and second normal form in
which no non-primary-key attribute is transitively dependent on the primary key.
13.12 Discuss how the definitions of 2NF and 3NF based on primary keys differ
from the general definitions of 2NF and 3NF. Provide an example to illustrate
your answer.
The above definitions for second (2NF) and third normal form (3NF) disallow
partial or transitive dependencies on the primary key of relations to avoid
update anomalies. However, these definitions do not take into account other
3
candidate keys of a relation, if any exist. The more general definitions for 2NF
and 3NF take account of the candidate keys of a relation. Note that this
requirement does not alter the definition for 1NF as this normal form is
independent of keys and functional dependencies. For the general
definitions, we define that a primary-key attribute is part of any candidate key
and that partial, full, and transitive dependencies are with respect to all
candidate keys of a relation.
Second normal form (2NF) A relation that is in first normal form and
every non-primary-key attribute is fully functionally dependent on any
candidate key.
Third normal form (3NF) A relation that is in first and second normal
form and in which no non-primary-key attribute is transitively dependent on
any candidate key.
When using the general definitions of 2NF and 3NF we must be aware of
partial and transitive dependencies on all candidate keys and not just the
primary key. This can make the process of normalization more complex,
however the general definitions place additional constraints on the relations
and may identify hidden redundancy in relations that could be missed.
13.13 Discuss the purpose of Boyce-Codd Normal Form (BCNF) and describe how
BCNF differs from 3NF. Provide an example to illustrate your answer.
BCNF is based on functional dependencies that take into account all candidate keys in a
relation, however BCNF also has additional constraints compared with the general definition
of 3NF given above.
Boyce–Codd normal form (BCNF) A relation is in BCNF if and
only if every determinant is a candidate key.
To test whether a relation is in BCNF, we identify all the determinants and
make sure that they are candidate keys.
See Sections 13.9 and 13.10.
13.14 Describe the concept of multi-valued dependency and describe how this
concept relates to 4NF. Provide an example to illustrate your answer.
Multi-valued Dependency (MVD) Represents a dependency
between attributes (for example, A, B, and C) in a relation, such that for each
value of A there is a set of values for B and a set of values for C. However, the
set of values for B and C are independent of each other.
A multi-valued dependency can be defined as being trivial or nontrivial. A
MVD A  B in relation R is defined as being trivial if (a) B is a
subset of A or (b) A ∪ B = R. A MVD is defined as being nontrivial if neither
(a) nor (b) are satisfied. A trivial MVD does not specify a constraint on a
relation, while a nontrivial MVD does specify a constraint.
4
Database Systems: Instructor’s Guide - Part III
Fourth Normal Form (4NF) A relation that is in Boyce-Codd Normal
Form and contains no nontrivial multi-valued dependencies.
Fourth normal form (4NF) is a stronger normal form than BCNF as it prevents relations from
containing nontrivial MVDs, and hence data redundancy. The normalization of BCNF
relations to 4NF involves the removal of the MVD from the relation by placing the
attribute(s) in a new relation along with a copy of the determinant(s).
See Section 13.11.
13.15 Describe the concept of join dependency and describe how this concept relates
to 5NF. Provide an example to illustrate your answer.
Lossless-join dependency A property of decomposition, which ensures
that no spurious tuples are generated when relations are reunited through a
natural join operation.
In splitting relations by projection, we are very explicit about the method of
decomposition. In particular, we are careful to use projections that can be
reversed by joining the resulting relations, so that the original relation is
reconstructed. Such a decomposition is called a lossless-join (also called a
nonloss or nonadditive) decomposition, because it preserves all the data in the
original relation and does not result in the creation of additional spurious tuples.
However, there are cases were we require to perform a lossless-join decompose
of a relation into more than two relations. These cases are the focus of the
lossless-join dependency and fifth normal form (5NF).
Fifth Normal Form (5NF) A relation that has no join dependency.
Fifth normal form (5NF) (also called project-join normal form (PJNF)) specifies
that a 5NF relation has no join dependency.
See Section 13.12.
Exercises
13.16 Examine the Patient Medication Form for the Wellmeadows Hospital case
study shown in Figure 13.25.
5
Figure 13.25 The WellMeadows Hospital Patient Medication Form.
(a) Identify the functional dependencies represented by the data shown in
the form in Figure 13.25.
Patient No → Full Name
Ward No → Ward Name
Drug No → Name, Description, Dosage, Method of Admin
Patient No, Drug No, Start Date → Units per Day, Finish date
The functional dependencies for Bed No are unclear. If Bed No was a
unique number for the entire hospital, then could say that Bed No
→ Ward No. However, from further examination of the requirements
specification, we can observe that Bed No is to do with the allocation
of patients on the waiting list to beds.
(b) Describe and illustrate the process of normalizing the data shown in
Figure 13.25 to first (1NF), second (2NF), third (3NF), and BCNF.
First Normal Form
Patient No, Drug No, Start Date, Full Name, Ward No, Ward
Name, Bed No, Name, Description, Dosage, Method of Admin,
Units per Day, Finish Date
Second Normal Form
Patient No, Drug No, Start Date, Ward No, Ward Name, Bed No,
Units per Day, Finish Date
Drug No, Name, Description, Dosage, Method of Admin
Patient No, Full Name
6
Database Systems: Instructor’s Guide - Part III
Third Normal Form/BCNF
Patient No, Drug No, Start Date, Ward No, Bed No, Units per Day,
Finish Date
Drug No, Name, Description, Dosage, Method of Admin
Patient No, Full Name
Ward No, Ward Name
(c) Identify the primary, alternate, and foreign keys in your BCNF relations.
Patient No(FK), Drug No(FK), Start Date, Ward No(FK), Bed No,
Units per Day, Finish Date
Drug No, Name, Description, Dosage, Method of Admin
Patient No, Full Name
Ward No, Ward Name
Primary keys underlined.
13.17 The table shown in Figure 13.26 lists dentist/patient appointment data. A
patient is given an appointment at a specific time and date with a dentist
located at a particular surgery. On each day of patient appointments, a dentist
is allocated to a specific surgery for that day.
Figure 13.26 Lists dentist/patient appointment data.
(a) The table shown in Figure 13.26 is susceptible to update anomalies.
Provide examples of insertion, deletion, and update anomalies.
The student should provide examples of insertion, deletion and update
anomalies using the data shown in the table. An example of a deletion
anomaly is if we delete the details of the dentist called ‘Helen Pearson’,
we also loose the appointment details of the patient called ‘Ian MacKay’.
(b) Describe and illustrate the process of normalizing the table shown in
Figure 13.26 to BCNF. State any assumptions you make about the data
shown in this table.
7
The student should state any assumptions made about the data shown in
the table. For example, we may assume that a patient is registered at only
one surgery. Also, a patient may have more than one appointment on a
given day.
8
staffNo aDate aTime staffNo dentistName
PK
3NF / BCNF
fd1 fd2
staffNo aDate
fd4
FK
FKPK
patNo
surgeryNo
fd5
FK
PK
staffNo aDate aTime dentistName patNo patName
PK
fd2
1NF
surgeryNo
fd4
fd2 and fd4 violates 2NF
2NF
staffNo aDate
Fd3’ violates 3NF
surgeryNo staffNo dentistName
fd1
fd3
staffN
o
aDate aTime patNo patName
fd5
patNo patName
PK
Fd3’
Database Systems: Instructor’s Guide - Part III
13.18 An agency called Instant Cover supplies part-time/temporary staff to hotels
within Scotland. The table shown in Figure 13.27 lists the time spent by
agency staff working at various hotels. The National Insurance Number (NIN)
is unique for every member of staff.
Figure 13.27 Instant Cover’s contracts
(a) The table shown in Figure 13.27 is susceptible to update anomalies.
Provide examples of insertion, deletion, and update anomalies.
The student should provide examples of insertion, deletion and update
anomalies using the data shown in the table. An example of an update
anomaly is if we wish to change the name of the employee called ‘Smith
J’, we may only change the entry in the first row and not the last with the
result that the database becomes inconsistent.
(b) Describe and illustrate the process of normalizing the table shown in
Figure 13.27 to BCNF. State any assumptions you make about the data
shown in this table.
The student should state any assumptions made about the data shown in
the table. For example, we may assume that a hotel may be associated
with one or more contracts.
9
10
NIN contractNo hours eName hNo hLoc
NIN contractNo hours
NIN eName
NIN contractNo hours contractNo hNo
hNo hLoc
PK
PK
FK
PK
PK
fd1
fd2
fd3
fd4
fd2 and fd3 violates 2NF
2NF
3NF / BCNF
fd1 fd3
fd4
1NF
contractNo hNo hLoc
fd4 violates 3NF
FK
FK
NIN eName
PK
fd2
Database Systems: Instructor’s Guide - Part III
13.19 The table shown in Figure 13.28 lists members of staff (staffName) working
in a given ward (wardName) and patients (patientName) allocated to a
given ward. There is no relationship between members of staff and patients in
each ward. In this example assume that staff name (staffName) uniquely
identifies each member of staff and that the patient name (patientName)
uniquely identifies each patient.
Figure 13.28 The WardStaffPatient relation.
(a) Describe why the relation shown in Figure 13.28 is in BCNF and not
in 4NF.
wardName  staffName
wardName  patientName
Relation is in BCNF but there is a nontrivial multi-valued dependency
in the relation, so relation is not in 4NF.
(b) The relation shown in Figure 13.28 is susceptible to update anomalies.
Provide examples of insertion, deletion, and update anomalies.
If we wanted to insert a new patient name, would have to add two
records, one for each member of staff.
If we wanted to update the name of patient Claire Johnson, we would
have to update two records.
If we wanted to delete the record corresponding to patient Claire
Johnson, we would have to delete two records.
(c) Describe and illustrate the process of normalizing the relation shown
in Figure 13.28 to 4NF.
To remove the MVD, we create two new relations:
WardStaff (wardName, staffName)
WardPatient(wardName, patientName)
13.20 The relation shown in Figure 13.29 describes hospitals (hospitalName) that
require certain items (itemDescription), which are supplied by suppliers
(supplierNo) to the hospitals (hospitalName). Furthermore, whenever a
hospital (h) requires a certain item (i) and a supplier (s) supplies that item (i)
and the supplier (s) already supplies at least one item to that hospital (h), then
the supplier (s) will also be supplying the required item (i) to the hospital (h).
11
In this example, assume that a description of an item (itemDescription)
uniquely identifies each type of item.
Figure 13.29 The HospitalItemSupplier relation.
(a) Describe why the relation shown in Figure 13.29 is not in 5NF.
This relation has a join dependency JD(hospitalName,
itemDescription, supplierNo) among the three projections:
R1(hospitalName, itemDescription), R2(hospitalName,
supplierNo), and R3(itemDescription, supplierNo) of
HospitalItemSupplier.
(b) Describe and illustrate the process of normalizing the relation shown
in Figure 13.29 to 5NF.
To remove the join dependency, we create the following
5NF relations:
HospitalItem(hospitalName, itemDescription)
HospitalSupplier(hospitalName, supplierNo)
ItemSupplier(itemDescription, supplierNo).
12

More Related Content

What's hot

Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
Satyamevjayte Haxor
 
weak slot and filler
weak slot and fillerweak slot and filler
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
soniyagoyal3
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
Kunal Anand
 
Triggers and active database
Triggers and active databaseTriggers and active database
Triggers and active database
BalaMuruganSamuthira
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
shah zeb
 
Floyd warshall algorithm
Floyd warshall algorithmFloyd warshall algorithm
Floyd warshall algorithm
A. S. M. Shafi
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
Mobeen Mustafa
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
bit allahabad
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
Kevin Jadiya
 
RDBMS.
RDBMS.RDBMS.
Er model
Er modelEr model
Er model
gagan bhattarai
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
Sakshi Jaiswal
 
Buffer management
Buffer managementBuffer management
Buffer management
KarthigaGunasekaran1
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Hitesh Mohapatra
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
Sujata Pardeshi
 
FIFO, LRU, OPTIMAL Page Replacement Algorithm
FIFO, LRU, OPTIMAL Page Replacement AlgorithmFIFO, LRU, OPTIMAL Page Replacement Algorithm
FIFO, LRU, OPTIMAL Page Replacement Algorithm
ArijitRoy118
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Biplap Bhattarai
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
shashidharPapishetty
 

What's hot (20)

Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
weak slot and filler
weak slot and fillerweak slot and filler
weak slot and filler
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
 
Triggers and active database
Triggers and active databaseTriggers and active database
Triggers and active database
 
Lecture 8
Lecture 8Lecture 8
Lecture 8
 
Floyd warshall algorithm
Floyd warshall algorithmFloyd warshall algorithm
Floyd warshall algorithm
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
Normalization PRESENTATION
Normalization PRESENTATIONNormalization PRESENTATION
Normalization PRESENTATION
 
Functional dependencies in Database Management System
Functional dependencies in Database Management SystemFunctional dependencies in Database Management System
Functional dependencies in Database Management System
 
RDBMS.
RDBMS.RDBMS.
RDBMS.
 
Er model
Er modelEr model
Er model
 
Topdown parsing
Topdown parsingTopdown parsing
Topdown parsing
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Buffer management
Buffer managementBuffer management
Buffer management
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
FIFO, LRU, OPTIMAL Page Replacement Algorithm
FIFO, LRU, OPTIMAL Page Replacement AlgorithmFIFO, LRU, OPTIMAL Page Replacement Algorithm
FIFO, LRU, OPTIMAL Page Replacement Algorithm
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
 

Similar to Chapter-13-solutions

Normalizatrion.ppt
Normalizatrion.pptNormalizatrion.ppt
Normalizatrion.ppt
Anvesha Joshi
 
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ijdms
 
Normalization
NormalizationNormalization
Normalization
Hardik Sondagar
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data Base
Ravinder Kamboj
 
Normalization1
Normalization1Normalization1
Computer Scinece:RDBMS :Normalisation
Computer Scinece:RDBMS :NormalisationComputer Scinece:RDBMS :Normalisation
Computer Scinece:RDBMS :Normalisation
St Mary's College,Thrissur,Kerala
 
b - Normalizing a Data Model
b - Normalizing a Data Modelb - Normalizing a Data Model
b - Normalizing a Data Model
Dimara Hakim
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
Joan Ador
 
Chapter – 4 Normalization and Relational Algebra.pdf
Chapter – 4 Normalization and Relational Algebra.pdfChapter – 4 Normalization and Relational Algebra.pdf
Chapter – 4 Normalization and Relational Algebra.pdf
TamiratDejene1
 
Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)
Vidyasagar Mundroy
 
Normalization
NormalizationNormalization
Normalization
rehanlko007
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
Drishti Bhalla
 
Function Dependencies and Normalization
 Function Dependencies and Normalization Function Dependencies and Normalization
Function Dependencies and Normalization
BLDE'S S.S.M.Polytechnic,Vijayapur
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
Normalization
NormalizationNormalization
ch7
ch7ch7
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
MisganawAbeje1
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
Raj Naik
 
Lecture No. 21-22.ppt
Lecture No. 21-22.pptLecture No. 21-22.ppt
Lecture No. 21-22.ppt
Ajit Mali
 
Chapter10
Chapter10Chapter10
Chapter10
sasa_eldoby
 

Similar to Chapter-13-solutions (20)

Normalizatrion.ppt
Normalizatrion.pptNormalizatrion.ppt
Normalizatrion.ppt
 
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
 
Normalization
NormalizationNormalization
Normalization
 
Normalization of Data Base
Normalization of Data BaseNormalization of Data Base
Normalization of Data Base
 
Normalization1
Normalization1Normalization1
Normalization1
 
Computer Scinece:RDBMS :Normalisation
Computer Scinece:RDBMS :NormalisationComputer Scinece:RDBMS :Normalisation
Computer Scinece:RDBMS :Normalisation
 
b - Normalizing a Data Model
b - Normalizing a Data Modelb - Normalizing a Data Model
b - Normalizing a Data Model
 
Penormalan/Normalization
Penormalan/NormalizationPenormalan/Normalization
Penormalan/Normalization
 
Chapter – 4 Normalization and Relational Algebra.pdf
Chapter – 4 Normalization and Relational Algebra.pdfChapter – 4 Normalization and Relational Algebra.pdf
Chapter – 4 Normalization and Relational Algebra.pdf
 
Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)Database Systems - Normalization of Relations(Chapter 4/3)
Database Systems - Normalization of Relations(Chapter 4/3)
 
Normalization
NormalizationNormalization
Normalization
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
Function Dependencies and Normalization
 Function Dependencies and Normalization Function Dependencies and Normalization
Function Dependencies and Normalization
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
Normalization
NormalizationNormalization
Normalization
 
ch7
ch7ch7
ch7
 
chapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdfchapter 4-Functional Dependency and Normilization.pdf
chapter 4-Functional Dependency and Normilization.pdf
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
 
Lecture No. 21-22.ppt
Lecture No. 21-22.pptLecture No. 21-22.ppt
Lecture No. 21-22.ppt
 
Chapter10
Chapter10Chapter10
Chapter10
 

Recently uploaded

Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
ScyllaDB
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB
 
ScyllaDB Real-Time Event Processing with CDC
ScyllaDB Real-Time Event Processing with CDCScyllaDB Real-Time Event Processing with CDC
ScyllaDB Real-Time Event Processing with CDC
ScyllaDB
 
intra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_Enintra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_En
NTTDATA INTRAMART
 
Real-Time Persisted Events at Supercell
Real-Time Persisted Events at  SupercellReal-Time Persisted Events at  Supercell
Real-Time Persisted Events at Supercell
ScyllaDB
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
UiPathCommunity
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
Neeraj Kumar Singh
 
Fuxnet [EN] .pdf
Fuxnet [EN]                                   .pdfFuxnet [EN]                                   .pdf
Fuxnet [EN] .pdf
Overkill Security
 
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
dipikamodels1
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
ScyllaDB
 
Multivendor cloud production with VSF TR-11 - there and back again
Multivendor cloud production with VSF TR-11 - there and back againMultivendor cloud production with VSF TR-11 - there and back again
Multivendor cloud production with VSF TR-11 - there and back again
Kieran Kunhya
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
UiPathCommunity
 
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to SuccessDynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
ScyllaDB
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
anilsa9823
 
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes
 
Elasticity vs. State? Exploring Kafka Streams Cassandra State Store
Elasticity vs. State? Exploring Kafka Streams Cassandra State StoreElasticity vs. State? Exploring Kafka Streams Cassandra State Store
Elasticity vs. State? Exploring Kafka Streams Cassandra State Store
ScyllaDB
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
TrustArc
 

Recently uploaded (20)

Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
 
ScyllaDB Real-Time Event Processing with CDC
ScyllaDB Real-Time Event Processing with CDCScyllaDB Real-Time Event Processing with CDC
ScyllaDB Real-Time Event Processing with CDC
 
intra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_Enintra-mart Accel series 2024 Spring updates_En
intra-mart Accel series 2024 Spring updates_En
 
Real-Time Persisted Events at Supercell
Real-Time Persisted Events at  SupercellReal-Time Persisted Events at  Supercell
Real-Time Persisted Events at Supercell
 
Session 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdfSession 1 - Intro to Robotic Process Automation.pdf
Session 1 - Intro to Robotic Process Automation.pdf
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
 
Fuxnet [EN] .pdf
Fuxnet [EN]                                   .pdfFuxnet [EN]                                   .pdf
Fuxnet [EN] .pdf
 
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
 
Multivendor cloud production with VSF TR-11 - there and back again
Multivendor cloud production with VSF TR-11 - there and back againMultivendor cloud production with VSF TR-11 - there and back again
Multivendor cloud production with VSF TR-11 - there and back again
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
 
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to SuccessDynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
 
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024
 
Elasticity vs. State? Exploring Kafka Streams Cassandra State Store
Elasticity vs. State? Exploring Kafka Streams Cassandra State StoreElasticity vs. State? Exploring Kafka Streams Cassandra State Store
Elasticity vs. State? Exploring Kafka Streams Cassandra State Store
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
TrustArc Webinar - Your Guide for Smooth Cross-Border Data Transfers and Glob...
 

Chapter-13-solutions

  • 1. Chapter 13 Normalization Review Questions 13.1 Describe the purpose of normalizing data. When we design a database for a relational system, the main objective in developing a logical data model is to create an accurate representation of the data, its relationships and constraints. To achieve this objective, we must identify a suitable set of relations. A technique that we can use to help identify such relations is called normalization. Normalization is a technique for producing a set of relations with desirable properties, given the data requirements of an enterprise. Normalization supports database designers by presenting a series of tests, which can be applied to individual relations so that a relational schema can be normalized to a specific form to prevent the possible occurrence of update anomalies. See also Sections 13.1 and 13.4. 13.2 Describe the types of update anomalies that may occur on a relation that has redundant data. A major aim of relational database design is to group attributes into relations so as to minimize information redundancy and thereby reduce the file storage space required by the base relations. Another serious difficulty using relations that have redundant information is the problem of update anomalies. These can be classified as insertion, deletion, or modification anomalies. See Section 13.2 13.3 Describe the concept of functional dependency. Functional dependency describes the relationship between attributes in a relation. For example, if A and B are attributes of relation R, B is functionally dependent on A (denoted A → B), if each value of A in R is associated with exactly one value of B in R. Functional dependency is a property of the meaning or semantics of the attributes in a relation. The semantics indicate how the attributes relate to one another and specify the functional dependencies between attributes. When a functional dependency is present, the dependency is specified as a constraint between the attributes. See also Section 13.3. 13.4 How is the concept of functional dependency associated with the process of normalization?
  • 2. Normalization is a formal technique for analyzing relations based on their primary key (or candidate keys in the case of BCNF) and functional dependencies. Normalization is often performed as a series of tests on a relation to determine whether it satisfies or violates the requirements of a given normal form. Three normal forms were initially proposed, which are called first (1NF), second (2NF) and third (3NF) normal form. Subsequently, a stronger definition of third normal form was introduced and is referred to as Boyce-Codd normal form (BCNF). All of these normal forms are based on the functional dependencies among the attributes of a relation. 13.4 What are the main characteristics of functional dependencies that are used when normalizing a relation? The main characteristics of functional dependencies that we use in normalization (see Section 13.3.1): • have a one-to-one relationship between attribute(s) on the left and right- hand side of a dependency; • hold for all time; • are nontrivial. 13.5 Describe how a database designer typically identifies the set of functional dependencies associated with a relation. Normally, the database designer starts by specifying functional dependencies that are semantically obvious; however, there are usually numerous other functional dependencies. In fact, the task of specifying all possible functional dependencies for ‘real’ database projects is more often than not, impractical. To begin to identify the set of functional dependencies F for a relation, typically first identify the dependencies that are determined from the semantics of the attributes of the relation. Then, apply Armstrong’s axioms (Rules 1 to 3) to infer additional functional dependencies that are also true for that relation. A systematic way to determine these additional functional dependencies is to first determine each set of attributes A that appears on the left-hand side of some functional dependencies and then to determine the set of all attributes that are dependent on A. Thus, for each set of attributes A we can determine the set A+ of attributes that are functionally determined by A based on F; (A+ is called the closure of A under F). 13.6 Describe Armstrong’s axioms. Armstrong’s axioms specify how new functional dependencies can be inferred from given ones. Let A, B, and C be subsets of the attributes of the relation R. Armstrong’s axioms are as follows: 1. Reflexivity: If B is a subset of A, then A → B 2. Augmentation : If A → B, then A,C → Β,C 3. Transitivity: If A → B and B → C, then A → C 2
  • 3. Database Systems: Instructor’s Guide - Part III 13.7 Describe the characteristics of a table in unnormalized form (UNF) and describe how such a table is converted to a first normal form (1NF) relation. A table in unnormalized form contains one or more repeating groups. To convert to first normal form (1NF) either remove the repeating group to a new relation along with a copy of the original key attribute(s), or remove the repeating group by entering appropriate data in the empty columns of rows containing the repeating data (see Section 13.5). 13.8 What is the minimal normal form that a relation must satisfy? Provide a definition for this normal form. Minimal normal form is 1NF: a relation in which the intersection of each row and column contains one and only one value (see Section 13.5). 13.9 Describe the two approaches to converting a first normal form (1NF) relation to second normal form (2NF) relation(s). The normalization of 1NF relations to 2NF involves the removal of partial dependencies. If a partial dependency exists, we remove the functionally dependent attributes from the relation by placing them in a new relation along with a copy of their determinant (see Section 13.6.2). 13.10 Describe the concept of full functional dependency and describe how this concept relates to 2NF. Provide an example to illustrate your answer. Full functional dependency Indicates that if A and B are attributes of a relation, B is fully functionally dependent on A if B is functionally dependent on A, but not on any proper subset of A. Second Normal Form (2NF) is a relation that is in first normal form and every non-primary-key attribute is fully functionally dependent on the primary key. 13.11 Describe the concept of transitive dependency and describe how this concept relates to 3NF. Provide an example to illustrate your answer. Transitive dependency A condition where A, B, and C are attributes of a relation such that if A → B and B → C, then C is transitively dependent on A via B (provided that A is not functionally dependent on B or C) Third Normal Form (3NF) is a relation that is in first and second normal form in which no non-primary-key attribute is transitively dependent on the primary key. 13.12 Discuss how the definitions of 2NF and 3NF based on primary keys differ from the general definitions of 2NF and 3NF. Provide an example to illustrate your answer. The above definitions for second (2NF) and third normal form (3NF) disallow partial or transitive dependencies on the primary key of relations to avoid update anomalies. However, these definitions do not take into account other 3
  • 4. candidate keys of a relation, if any exist. The more general definitions for 2NF and 3NF take account of the candidate keys of a relation. Note that this requirement does not alter the definition for 1NF as this normal form is independent of keys and functional dependencies. For the general definitions, we define that a primary-key attribute is part of any candidate key and that partial, full, and transitive dependencies are with respect to all candidate keys of a relation. Second normal form (2NF) A relation that is in first normal form and every non-primary-key attribute is fully functionally dependent on any candidate key. Third normal form (3NF) A relation that is in first and second normal form and in which no non-primary-key attribute is transitively dependent on any candidate key. When using the general definitions of 2NF and 3NF we must be aware of partial and transitive dependencies on all candidate keys and not just the primary key. This can make the process of normalization more complex, however the general definitions place additional constraints on the relations and may identify hidden redundancy in relations that could be missed. 13.13 Discuss the purpose of Boyce-Codd Normal Form (BCNF) and describe how BCNF differs from 3NF. Provide an example to illustrate your answer. BCNF is based on functional dependencies that take into account all candidate keys in a relation, however BCNF also has additional constraints compared with the general definition of 3NF given above. Boyce–Codd normal form (BCNF) A relation is in BCNF if and only if every determinant is a candidate key. To test whether a relation is in BCNF, we identify all the determinants and make sure that they are candidate keys. See Sections 13.9 and 13.10. 13.14 Describe the concept of multi-valued dependency and describe how this concept relates to 4NF. Provide an example to illustrate your answer. Multi-valued Dependency (MVD) Represents a dependency between attributes (for example, A, B, and C) in a relation, such that for each value of A there is a set of values for B and a set of values for C. However, the set of values for B and C are independent of each other. A multi-valued dependency can be defined as being trivial or nontrivial. A MVD A  B in relation R is defined as being trivial if (a) B is a subset of A or (b) A ∪ B = R. A MVD is defined as being nontrivial if neither (a) nor (b) are satisfied. A trivial MVD does not specify a constraint on a relation, while a nontrivial MVD does specify a constraint. 4
  • 5. Database Systems: Instructor’s Guide - Part III Fourth Normal Form (4NF) A relation that is in Boyce-Codd Normal Form and contains no nontrivial multi-valued dependencies. Fourth normal form (4NF) is a stronger normal form than BCNF as it prevents relations from containing nontrivial MVDs, and hence data redundancy. The normalization of BCNF relations to 4NF involves the removal of the MVD from the relation by placing the attribute(s) in a new relation along with a copy of the determinant(s). See Section 13.11. 13.15 Describe the concept of join dependency and describe how this concept relates to 5NF. Provide an example to illustrate your answer. Lossless-join dependency A property of decomposition, which ensures that no spurious tuples are generated when relations are reunited through a natural join operation. In splitting relations by projection, we are very explicit about the method of decomposition. In particular, we are careful to use projections that can be reversed by joining the resulting relations, so that the original relation is reconstructed. Such a decomposition is called a lossless-join (also called a nonloss or nonadditive) decomposition, because it preserves all the data in the original relation and does not result in the creation of additional spurious tuples. However, there are cases were we require to perform a lossless-join decompose of a relation into more than two relations. These cases are the focus of the lossless-join dependency and fifth normal form (5NF). Fifth Normal Form (5NF) A relation that has no join dependency. Fifth normal form (5NF) (also called project-join normal form (PJNF)) specifies that a 5NF relation has no join dependency. See Section 13.12. Exercises 13.16 Examine the Patient Medication Form for the Wellmeadows Hospital case study shown in Figure 13.25. 5
  • 6. Figure 13.25 The WellMeadows Hospital Patient Medication Form. (a) Identify the functional dependencies represented by the data shown in the form in Figure 13.25. Patient No → Full Name Ward No → Ward Name Drug No → Name, Description, Dosage, Method of Admin Patient No, Drug No, Start Date → Units per Day, Finish date The functional dependencies for Bed No are unclear. If Bed No was a unique number for the entire hospital, then could say that Bed No → Ward No. However, from further examination of the requirements specification, we can observe that Bed No is to do with the allocation of patients on the waiting list to beds. (b) Describe and illustrate the process of normalizing the data shown in Figure 13.25 to first (1NF), second (2NF), third (3NF), and BCNF. First Normal Form Patient No, Drug No, Start Date, Full Name, Ward No, Ward Name, Bed No, Name, Description, Dosage, Method of Admin, Units per Day, Finish Date Second Normal Form Patient No, Drug No, Start Date, Ward No, Ward Name, Bed No, Units per Day, Finish Date Drug No, Name, Description, Dosage, Method of Admin Patient No, Full Name 6
  • 7. Database Systems: Instructor’s Guide - Part III Third Normal Form/BCNF Patient No, Drug No, Start Date, Ward No, Bed No, Units per Day, Finish Date Drug No, Name, Description, Dosage, Method of Admin Patient No, Full Name Ward No, Ward Name (c) Identify the primary, alternate, and foreign keys in your BCNF relations. Patient No(FK), Drug No(FK), Start Date, Ward No(FK), Bed No, Units per Day, Finish Date Drug No, Name, Description, Dosage, Method of Admin Patient No, Full Name Ward No, Ward Name Primary keys underlined. 13.17 The table shown in Figure 13.26 lists dentist/patient appointment data. A patient is given an appointment at a specific time and date with a dentist located at a particular surgery. On each day of patient appointments, a dentist is allocated to a specific surgery for that day. Figure 13.26 Lists dentist/patient appointment data. (a) The table shown in Figure 13.26 is susceptible to update anomalies. Provide examples of insertion, deletion, and update anomalies. The student should provide examples of insertion, deletion and update anomalies using the data shown in the table. An example of a deletion anomaly is if we delete the details of the dentist called ‘Helen Pearson’, we also loose the appointment details of the patient called ‘Ian MacKay’. (b) Describe and illustrate the process of normalizing the table shown in Figure 13.26 to BCNF. State any assumptions you make about the data shown in this table. 7
  • 8. The student should state any assumptions made about the data shown in the table. For example, we may assume that a patient is registered at only one surgery. Also, a patient may have more than one appointment on a given day. 8 staffNo aDate aTime staffNo dentistName PK 3NF / BCNF fd1 fd2 staffNo aDate fd4 FK FKPK patNo surgeryNo fd5 FK PK staffNo aDate aTime dentistName patNo patName PK fd2 1NF surgeryNo fd4 fd2 and fd4 violates 2NF 2NF staffNo aDate Fd3’ violates 3NF surgeryNo staffNo dentistName fd1 fd3 staffN o aDate aTime patNo patName fd5 patNo patName PK Fd3’
  • 9. Database Systems: Instructor’s Guide - Part III 13.18 An agency called Instant Cover supplies part-time/temporary staff to hotels within Scotland. The table shown in Figure 13.27 lists the time spent by agency staff working at various hotels. The National Insurance Number (NIN) is unique for every member of staff. Figure 13.27 Instant Cover’s contracts (a) The table shown in Figure 13.27 is susceptible to update anomalies. Provide examples of insertion, deletion, and update anomalies. The student should provide examples of insertion, deletion and update anomalies using the data shown in the table. An example of an update anomaly is if we wish to change the name of the employee called ‘Smith J’, we may only change the entry in the first row and not the last with the result that the database becomes inconsistent. (b) Describe and illustrate the process of normalizing the table shown in Figure 13.27 to BCNF. State any assumptions you make about the data shown in this table. The student should state any assumptions made about the data shown in the table. For example, we may assume that a hotel may be associated with one or more contracts. 9
  • 10. 10 NIN contractNo hours eName hNo hLoc NIN contractNo hours NIN eName NIN contractNo hours contractNo hNo hNo hLoc PK PK FK PK PK fd1 fd2 fd3 fd4 fd2 and fd3 violates 2NF 2NF 3NF / BCNF fd1 fd3 fd4 1NF contractNo hNo hLoc fd4 violates 3NF FK FK NIN eName PK fd2
  • 11. Database Systems: Instructor’s Guide - Part III 13.19 The table shown in Figure 13.28 lists members of staff (staffName) working in a given ward (wardName) and patients (patientName) allocated to a given ward. There is no relationship between members of staff and patients in each ward. In this example assume that staff name (staffName) uniquely identifies each member of staff and that the patient name (patientName) uniquely identifies each patient. Figure 13.28 The WardStaffPatient relation. (a) Describe why the relation shown in Figure 13.28 is in BCNF and not in 4NF. wardName  staffName wardName  patientName Relation is in BCNF but there is a nontrivial multi-valued dependency in the relation, so relation is not in 4NF. (b) The relation shown in Figure 13.28 is susceptible to update anomalies. Provide examples of insertion, deletion, and update anomalies. If we wanted to insert a new patient name, would have to add two records, one for each member of staff. If we wanted to update the name of patient Claire Johnson, we would have to update two records. If we wanted to delete the record corresponding to patient Claire Johnson, we would have to delete two records. (c) Describe and illustrate the process of normalizing the relation shown in Figure 13.28 to 4NF. To remove the MVD, we create two new relations: WardStaff (wardName, staffName) WardPatient(wardName, patientName) 13.20 The relation shown in Figure 13.29 describes hospitals (hospitalName) that require certain items (itemDescription), which are supplied by suppliers (supplierNo) to the hospitals (hospitalName). Furthermore, whenever a hospital (h) requires a certain item (i) and a supplier (s) supplies that item (i) and the supplier (s) already supplies at least one item to that hospital (h), then the supplier (s) will also be supplying the required item (i) to the hospital (h). 11
  • 12. In this example, assume that a description of an item (itemDescription) uniquely identifies each type of item. Figure 13.29 The HospitalItemSupplier relation. (a) Describe why the relation shown in Figure 13.29 is not in 5NF. This relation has a join dependency JD(hospitalName, itemDescription, supplierNo) among the three projections: R1(hospitalName, itemDescription), R2(hospitalName, supplierNo), and R3(itemDescription, supplierNo) of HospitalItemSupplier. (b) Describe and illustrate the process of normalizing the relation shown in Figure 13.29 to 5NF. To remove the join dependency, we create the following 5NF relations: HospitalItem(hospitalName, itemDescription) HospitalSupplier(hospitalName, supplierNo) ItemSupplier(itemDescription, supplierNo). 12
  翻译: