Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture # 16 Chapter # 10 Normalization Database Systems.

Similar presentations


Presentation on theme: "Lecture # 16 Chapter # 10 Normalization Database Systems."— Presentation transcript:

1 Lecture # 16 Chapter # 10 Normalization Database Systems

2 Second Normal Form (2NF) A relation that is in 1NF and every non-primary-key attribute is fully functionally dependent on the primary key. In other words – A table that is in 1NF and in which the values of each non-primary-key column can be worked out from the values in all the columns that make up the primary key is said to be in 2NF. 2

3 2NF Identify the primary key for the 1NF relation. Identify the functional dependencies in the relation. If partial dependencies exist on the primary key remove them by placing then in a new relation along with a copy of their determinant (Primary Key). 3

4 Example 1: TempStaffAllocation table is in 2NF 4 u 2NF : A relation that is in 1NF and every non- primary-key attribute is fully functionally dependent on the primary key. u Is table in 1NF (Yes)

5 Example 1: TempStaffAllocation table is not in 2NF 5

6 Example 1: Converting TempStaffAllocation table to 2NF 6

7 Example(2) 2NF EmpNo: Employee Number (PK). ProNo: Project Number (PK). Hours: Number of Work Hours in the project. EmpName: Employee Name. ProName: Project Name. ProLocation: Project Location. Is table in 2NF ? 7

8 Example(2) 2NF EmployeePrject (Is table in 1NF) (YES) EmpNoProNoHoursEmpNameProNameProLocation 8 EmployeePrject (Is table in 2NF) EmpNoProNoHoursEmpNameProNameProLocation 10.3

9 Example(2) 2NF Emp_proj1 (2NF) EmpNoProNoHours Emp_proj2 (2NF) EmpNoEmpName Emp_proj3 (2NF) ProNoProNameProLocation 9

10 Example(3) 2NF SNo: Student Number (PK). CNo: Course Number (PK). SName: Student Name. CName: Course Name. Is table in 2NF ? 10

11 Example(3) 2NF Student (Yes, Student table in 1NF) SNoCNoSNameCName Student (Is Student table in 2NF) SNoCNoSNameCName 11

12 Example(3) 2NF Student (2NF) SNoSName Course (2NF) CNoCName Sts_Crs (2NF) SNO ------- CNO -------- 12

13 Third Normal Form (3NF) A relation that is in 1NF and 2NF and in which no non-primary-key attribute is transitively dependent on the primary key. In other words – A table that is in 1NF and 2NF and in which all non-primary-key columns can be worked out from only the primary key column(s) and no other columns. 13

14 2NF to 3NF Identify the primary key in the 2NF relation. Identify functional dependencies in the relation. If transitive dependencies exist on the primary key remove them by placing them in a new relation along with a copy of their dominant. 14

15 Example 3-1 :StaffBranch table is in 3NF 15 u A relation that is in 1NF and 2NF and in which no non- primary-key attribute is transitively dependent on the primary key. u Is table in 1NF (Yes)

16 Example 3-1 :StaffBranch table is in 3NF 16 u Is table in 2NF (Yes)

17 Example 3-1 : StaffBranch table is not in 3NF 17 2NF 3NF

18 Example 3-1 : Converting the StaffBranch table to 3NF 18

19 Example(3-2) 3NF EmpNo: Employee Number (PK). EmpName: Employee Name. BDate: Birth Date. Address: Address DNo: Department Number. DName: Department Name. Is table in 3NF ? 19

20 Example(3-2) 3NF Employee (Is Employee table in 1NF) (YES) EmpNoEmpNameBDateAddressDNoDName Employee (Is Employee table in 2NF) (YES) EmpNoEmpNameBDateAddressDNoDName 20

21 Example(3-2) 3NF Employee (Is Employee table in 3NF) EmpNoEmpNameBDateAddressDNo DNam e 21

22 Example(3-2) 3NF Employee in 3NF EmpNoEmpNameBDate Addres s DNo Department in 3NF DNoDName 22

23 Example(3-3) 3NF CNo: Course Number (PK). CName: Course Name. InsNo: Instructor Number. InsOff: Instructor Office. Is table in 3NF ? 23

24 Example(3-3) 3NF Student (YES table in 1NF) CNoCNameInsNoInsOff Student (Is table in 2NF) (YES) CNoCNameInsNoInsOff 24

25 Example(3-3) 3NF Student (Is table in 3NF) CNoCNameInsNoInsOff 25

26 Example(3-3) 3NF Student (3NF) CNoCNameInsNo Instractor (3NF) InsNoInsOff 26


Download ppt "Lecture # 16 Chapter # 10 Normalization Database Systems."

Similar presentations


Ads by Google