18CSC303J - Database Management System UNIT 4 & 5 - 12 MARKS
12M: 2) 2NF and 3NF with examples Second Normal Form (2NF): For a table to be in the Second Normal Form, It should be in the first normal form It should not have partial dependency 1 column primary key (Basically no 2 rows have the same primary keys) Example: Here the course code is unique and can be taken as primary key SUBJECT NAME COURSE CODE DBMS CS101 CD CS152 AI CS154 Storing student enrollment in various courses. Here, both the columns are not unique, but the tuple (student name, course code) is unique since a student cannot enroll in the same course more than once). But this is not the second normal form. STUDENT NAME COURSE CODE A CS152 B CS101 A CS154 C CS101 To convert to 2NF, we need to break it into 2 tables. In the first table, the second column is unique and we can attach each of these with the course codes in the second table STUDENT NAME ENROLLMENT NUMBER A 1 B 2 C 3 COURSE CODE ENROLLMENT NUMBER CS101 2 CS101 3 CS152 1 CS154 1 These 2 tables together provide u...
Comments
Post a Comment