2. First normal form (1 NF)
Rules:
• Eliminate repeating groups in individual tables.
• Create a separate table for each set of related data.
• Identify each set of related data with a primary key.
• Do not use multiple fields in a single table to store similar data.
Example: Relation EMPLOYEE is not in 1NF because of multi-valued
attribute EMP_PHONE.
• EMPLOYEE table:
EMP_ID EMP_NAME EMP_PHONE EMP_STATE1 EMP_STATE2
14 John 7272826385,
9064738238
UP UP
20 Harry 8574783832 Bihar
12 Sam 7390372389,
8589830302
Punjab Punjab
3. EMP_ID EMP_NAME EMP_PHONE EMP_STATE#
14 John 7272826385 UP
14 John 9064738238 UP
20 Harry 8574783832 Bihar
12 Sam 7390372389 Punjab
12 Sam 8589830302 Punjab
5. Second normal form
• It exists in 1NF
• In the second normal form, all non-key attributes are fully
functional dependent on the primary key.
• Create separate tables for sets of values that apply to
multiple records.
• no Partial Dependency
TEACHER table
TEACHER_ID SUBJECT TEACHER_AGE
25 Chemistry 30
25 Biology 30
47 English 35
83 Math 38
83 Computer 38
7. Ex 2:<StudentProject>
StudentID ProjectID StudentName ProjectName
S89 P09 Olivia Geo Location
S76 P07 Jacob Cluster
Exploration
S56 P03 Ava IoT Devices
S92 P05 Alexandra Cloud
Deployment
8. StudentID ProjectID StudentName
S89 P09 Olivia
S76 P07 Jacob
S56 P03 Ava
S92 P05 Alexandra
ProjectID ProjectName
P09 Geo Location
P07 Cluster Exploration
P03 IoT Devices
P05 Cloud Deployment
9. Third Normal Form (3NF)
• It should be in second normal form.
• A relation is in third normal form, if there is no
transitive dependency for non-prime
attributes.
• 3NF is used to reduce the data duplication.
EMP_ID EMP_NAME EMP_ZIP EMP_STATE EMP_CITY
222 Harry 201010 UP Noida
333 Stephan 02228 US Boston
444 Lan 60007 US Chicago
555 Katharine 06389 UK Norwich
666 John 462007 MP Bhopal
10. • Super key :
• {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, E
MP_ZIP}
• Non-prime attributes: In the given table, all attributes
except EMP_ID are non-prime.
• EMP_STATE & EMP_CITY EMP_ZIP & EMP_ZIP EMP_ID.
• The non-prime attributes (EMP_STATE, EMP_CITY)
transitively dependent on super key(EMP_ID). It violates
the rule of third normal form.
• That's why we need to move the EMP_CITY and EMP_STATE
to the new <EMPLOYEE_ZIP> table, with EMP_ZIP as a
Primary key.
11. EMP_ID EMP_NAME EMP_ZIP
222 Harry 201010
333 Stephan 02228
444 Lan 60007
555 Katharine 06389
666 John 462007
EMP_ZIP EMP_STATE EMP_CITY
201010 UP Noida
02228 US Boston
60007 US Chicago
06389 UK Norwich
462007 MP Bhopal
12. Ex2:
ID NAME SUBJECT STATE COUNTRY
29 Lalita English Gujrat INDIA
33 Ramesh Geography Punjab INDIA
49 Sarita Mathematics Maharashtra INDIA
78 Zayed History Bihar INDIA
The F.D set { ID->NAME, NAME->SUBJECT,
NAME->STATE, STATE->COUNTRY}
13. ID STATE COUNTRY
29 Gujrat INDIA
33 Punjab INDIA
49 Maharashtra INDIA
78 Bihar INDIA
ID NAME SUBJECT
29 Lalita English
33 Ramesh Geography
49 Sarita Mathematics
78 Zayed History
14. BCNF
Rules:
• It should be in the Third Normal Form.
• And, for any dependency A → B, A should be
a key.
• In BCNF as in the functional dependencies left
side part is a key.
15. Ex:
F.D:
emp_id -> emp_nationality
emp_dept -> {dept_type, dept_no_of_emp}
emp_id emp_nationality emp_dept dept_type No_of_emp
1001 Austrian
Production and
planning
D001 200
1001 Austrian stores D001 250
1002 American
design and
technical
support
D134 100
1002 American
Purchasing
department
D134 600
16. emp_id emp_nationality
1001 Austrian
1002 American
emp_dept dept_type dept_no_of_emp
Production and
planning
D001 200
stores D001 250
design and technical
support
D134 100
Purchasing
department
D134 600
emp_id emp_dept
1001 Production and planning
1001 stores
1002 design and technical support
1002 Purchasing department
17. Ex 2: BCNF
• A table where student is opted more than one
subject .
stud_id stud_nationality stud_subject dept_type sub_code
1001 Indian ECE SCIENCE 200
1002 American GEOGRAPHY ENVIRONMENTAL 250
1002 American CSE SCIENCE 280
1001 Indian ANTHROPOLOGY ENVIRONMENTAL 300
18. 1: Identify Functional dependencies in the table
above
2: Identify Candidate key
Candidate key: {stud_id, stud_subject}
3. decompose it into three tables and map
stud_id -> stud_nationality
stud_subject -> {dept_type, sub_code}
19. After decomposition:
stud_id stud_nationality
1001 Indian
1002 American
stud_subject dept_type sub_code
ECE SCIENCE 200
GEOGRAPHY ENVIRONMENTAL 250
CSE
SCIENCE
280
ANTHROPOLOGY
ENVIRONMENTAL 300
stud_id stud_subject
1001 GEOGRAPHY
1002 stores
1002 CSE
1002 ANTHROPOLOGY
Candidate keys:
For first table: stud_id
For second table: stud_subject
For third table: {stud_id, stud_subject}