Presentation is loading. Please wait.

Presentation is loading. Please wait.

Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber.

Similar presentations


Presentation on theme: "Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber."— Presentation transcript:

1 Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber

2 Normalization Process: Exercise 1: Step 2 IST2102 Step 2. Identify all the functional dependencies in the relation. DormName  DormCost Trivial dependency: StudentNumber  (LastName, FirstName, DormName, DormCost)

3 Normalization Process: Exercise 1: Step 3 IST2103 Step 3. If any determinant is not a candidate key, the relation is not well formed. StudentNumberStudentNumber  (LastName, FirstName, DormName, DormCost) DormName  DormCost

4 Normalization Process: Exercise 1: Step 3 IST2104 Step 3. Examine the determinants of the functional dependencies. If any determinant is not a candidate key, the relation is not well formed. In this case: a.Place the columns of the functional dependency in a new relation of their own. DORM(DormName, DormCost) b.Make the determinant of the functional dependency the primary key of the new relation. DORM(DormName, DormCost) c.Leave a copy of the determinant as a foreign key in the original relation. STU_DORM(StudentNumber, LastName, FirstName, DormName) d.Create a referential integrity constraint between the original relation and the new relation. DormName in STU_DORM must exist in DormName in DORM

5 Normalization Process: Exercise 1: Step 4 IST2105 Step 4. Repeat step 3 as many times as necessary until every determinant of every relation is a candidate key. STU_DORM(StudentNumber, LastName, FirstName, DormName) DORM(DormName, DormCost) DormName in STU_DORM must exist in DormName in DORM Well-formed relational model design

6 How to place the foreign key? Q: In Step 3, why don’t we connect these two tables by placing StudentNumber into DORM table instead? A: Each dorm may correspond to multiple students, resulting multiple values in single cell. STU_DORM(StudentNumber, LastName, FirstName, DormName) DORM(DormName, DormCost)

7 How to place the foreign key? IST2107 STUDENT(StudentID, StudentName, Student’sDepartment, Email) COURSE(CourseID, Instructor, CourseName, Location) REGISTRATION(StudentID, CourseID) StudentID in REGISTRATION must exist in StudentID in STUDENT COURSEID in REGISTRATION must exist in CourseID in COURSE Sometimes it is inappropriate to place the primary key from either table to another. In such cases, we need to create a new table to connect them together:


Download ppt "Normalization Process: Exercise 1: Step 1 IST2101 Step 1. Identify all the candidate keys of the relation. StudentNumber."

Similar presentations


Ads by Google