Transcript
Page 1: er & normalization exercises

Normalization Exercises

Normalization and E-R problem examplesThis week we will walk through additional examples to give you practice normalizing tables and drawing E-R diagrams.

Quick ReviewFirst Normal Form: No repeating groups or multi-valued attributesSecond Normal Form: Non-key attributes must be fully functionally dependent based on the primary key.Third Normal Form: Eliminate transitive dependencies.BCNF : Eliminate dependencies from the key on non-key attributes.

Normalization ExamplesFor the next four problems, we will indicatea) Which normal form(s) are violated?b) Give an example of insert, deletion, and modification anomalies associated with thedata.c) Present a data structure diagram showing a reorganized table structure that is in atleast third normal form.

Problem 1A public library keeps the following table of data about its patrons:

Which normal forms are violated?

Anomalies?

Page 2: er & normalization exercises

Normalization Exercises

Data structure diagram?

Problem 2A school keeps the following information about its students:

Which normal forms are violated?

Page 3: er & normalization exercises

Normalization Exercises

Anomalies?

Data structure diagram?

Page 4: er & normalization exercises

Normalization Exercises

Problem 3A company keeps the following table of data about orders.

Which normal forms are violated?

Anomalies?

Page 5: er & normalization exercises

Normalization Exercises

Data structure diagram?

Extra Problem) A video store uses the following table to keep track of movies.

Page 6: er & normalization exercises

Normalization Exercises

Can you suggest a better primary key to uniquely identify a movie? (Ok to addattributes)

Which normal forms are violated?

Anomalies?

Data structure diagram? 1NF and then 2NF.

Page 7: er & normalization exercises

Normalization Exercises

A Movie ID would help us here in many ways! E.g., saving space for redundant data.

Problem 4The following set of data represents a sample of the types of data used by a clerk in alibrary. The clerk also indicates that there can be borrowers who do not have a bookchecked out and books that have not yet been checked out. All other relationships aremandatory. Draw an ER diagram and a set of domain descriptions for this user view.

Page 8: er & normalization exercises

Normalization Exercises

Data Domain Descriptions:

Problem 5Based on the following document and description, create an E-R diagram for the data ofthis user’s view and the domain description.Registration clerk: I produce the class schedule report you see here. Each student is senta copy of his/her class schedule. Some restrictions, which may not be obvious from the

Page 9: er & normalization exercises

Normalization Exercises

sample data, should be noted. The advisor assigned to a student must be a professor inthe department in which the student is majoring (a CIS major must be advised by a CISprofessor). Course numbers consist of a 3-digit alphabetic prefix followed by 3 numericdigits. The alphabetic prefix must correspond to a valid department code.

E-R Diagrams:

Page 10: er & normalization exercises

Normalization Exercises

Domain description:

Page 11: er & normalization exercises

Normalization Exercises


Recommended