Assignment # 4
Name M Nadeem
Reg No FA20-BSE-035
Subject Database
Assigned by Sir Farman Ullah
Dead Line 6/3/22
COMSATS University Islamabad
Vehari Campus
@@@@@@@@@@@@@@@@@@@@@@
1 NF
Roles For 1NF:
1. Single valued attribute(atomic values)
2. Attribute domain should not change
3. Unique name for attribute /columns
4. Order does not matter
id name age subject
1 Ali 18 DBMS,OS
2 hamza 18 DBMS
3 usman 19 Java
id name age subject
1 Ali 18 DBMS
1 Ali 18 OS
2 hamza 18 DBMS
3 usman 19 Java
2NF
Roles For 2NF:
1. table should be 1NF
2. No partial dependency
Dependency~functional dependency~all columns
dependent on primary key
Partial dependency:
When there are two or more
primary key in table.
Any attribute depends only on a part of primary
key.
Student
Stud_id Stud_name address
201 Ali vehari
201 Hamza Multan
202 usman lahore
Subject
Sub_id Sub_name
1 Eng
2 Urdu
1 math
Score_id Stud_id Sub_id marks teachers
101 201 1 20 Shafiq
102 202 2 80 Hasan
103 203 1 20 abid
3NF
Roles for 3NF
1. table should be in 2NF
2.no transitive dependency:
When columns depend
on a column which is not primary key.
Score_id Stud_id Sub_id marks Exame_name Total_marks
101 201 1 16 Mid 20
102 201 2 69 Final 80
103 202 1 19 mid 20
Score
Score_id Stud_id Sub_id marks Exame_id
101 201 1 16 1
102 201 2 69 2
103 202 1 19 3
Exame
Exame_id Exame_name Total_marks
1 Mid 20
2 Final 80
3 mid 20