Chapter 6 Part1 Hands-On Exercies With Answers
Chapter 6 Part1 Hands-On Exercies With Answers
Chapter 6 Part1 Hands-On Exercies With Answers
Problem 1
Given the dependency diagrams in the following figures, identify and discuss each of the
indicated dependencies. Pease notes (C1, C2) is the composite primary key.
Convert from 1NF to 2NF: remove partial dependencies and create new tables.
1
Convert from 2NF to 3NF: remove transitive dependencies and create new tables.
2
Problem #2
The dependency diagram in following figure indicates that authors are paid royalties for
each book they write for a publisher. The amount of the royalty can vary by author, by book, and
by edition of the book.
Some description:
If a book can only have one author, then you can imply that knowing the ISBN, you also
know the author and the royalty rate. However, it is very common for a book to have multiple
authors, and in that case, the authors may have the same or different royalty rates. In the above
figure, it uses a composite primary key (ISBN, Author_Num), which can determine all
other attributes in the table. The main point of this design is the flexibility of it. Flexibility is
important because it “future-proofs” the data model by allowing the model to support changes in
the business rules in the future.
Q1: Write the relational schema for the 1NF shown in the above figure. Also describe partial
and transitive dependencies if any.
Solution:
Relational Scheme:
1NF (ISBN, Author_Num, BookTitle, LastName, Publisher, Royalty, Edition)
Partial Dependencies
ISBN → BookTitle, Publisher, Edition
Author_Num → LastName
Transitive Dependencies
BookTitle→ Publisher
3
Q2: Convert from 1NF to 2NF
Solution: We need to create new tables to remove partial dependencies. The following figure
showing the 2NF formulations results.
Relational Scheme:
Book (ISBN, BookTitle, Publisher, Edition)
Author (Author_Num, LastName)
Author_Royalty (ISBN, Author_Num, Royalty)
4
Q3: Convert from 2NF to 3NF (including indicating FK)
Solution: The following figure showing the 3NF normalization results.
Relational Scheme:
Book (ISBN, BookTitle (FK), Edition)
Publisher (BookTitle, Publisher)
Author (Author_Num, LastName)
Author_Royalty (ISBN(FK), Author_Num(FK), Royalty)
5
Problem #3
Given that information, write the relational schema and the normalization process. Make
sure that you label the transitive and/or partial dependencies.
Solution:
First step: write down the relational scheme
The relational schema:
ITEM (ITEM_ID, ITEM_DESCRIPTION, ROOM_NUMBER, BLDG_CODE, BLDG_NAME,
BLDG_MANAGER)
6
Third step: transfer from 2NF to 3NF
If we make 3NF strictly based on the data provided, the relational schemas are written as
follows:
ITEM (ITEM_ID, ITEM_DESCRIPTION, ROOM_NUMBER (FK))
ROOM (ROOM_NUMBER, BLDG_CODE (FK))
BUILDING (BLDG_CODE, BLDG_NAME (FK))
BILDING_NAME (BLDG_NAME, BLDG_MANAGER)
7
each building. Thus, we have also renamed BLDG_MANAGER as EMP_NUM to reflect the
fact that an employee is the manager of the building and we have added the EMPLOYEE entity.