DBMS - FIRST NORMAL FORM

7
DATABASE MANAGEMENT SYSTEM NORMALIZATION

Transcript of DBMS - FIRST NORMAL FORM

Page 1: DBMS - FIRST NORMAL FORM

DATABASE MANAGEMENT SYSTEM

NORMALIZATION

Page 2: DBMS - FIRST NORMAL FORM

It was defined to disallow multi valued attributes, compositeattributes and their combinations (Complex Attributes).

Attribute values permitted by normal form are single atomic (or indivisible)

It disallows “ relations within relations” or relations as attribute values within tuples”.

FIRST NORMAL FORM

Page 3: DBMS - FIRST NORMAL FORM

Example

DNAME DNUMBER DHEAD

CSE 101 Raju

IT 102 Ram

ECE 103 Rahul

DEPARTMENT Relation SchemaPrimary Key DNUMBER

DNAME DNUMBER DHEAD DLOCATION

CSE 101 Raju Thr, Tvm

IT 102 Ram Thr

ECE 103 Rahul Thr, Tvm

DNUMBER is functionally dependent with DNAME, DHEADNow we extend with the attribute DLOCATION

DLOCATION contains atomic values but some tuples can have a set of values. DLOCATION is not functionally dependent on the primary key DNUMBER. The Domain of DLOCATION contain set of values and hence it is non-atomic.

Page 4: DBMS - FIRST NORMAL FORM

Converting to First Normal Form

Solution I :-

Remove the attribute DLOCATION that violates 1NF and place it in a separate relation DEPT_LOCATION along with the primary key DNUMBER of the DEPARTMENT Schema

DNAME DNUMBER DHEAD

CSE 101 Raju

IT 102 Ram

ECE 103 Rahul

DNUMBER DLOCATION

101 Thr

101 Tvm

102 Thr

103 Thr

103 Tvm

DEPARTMENT DEPT_LOCATION

Decomposes the non - 1nf relation into two 1nf relations

Page 5: DBMS - FIRST NORMAL FORM

Solution II :-

Expand the key so that there will be a separate tuple in the original DEPARTMENT relation for each location of a DEPARTMENT. Using this method redundancy occurs in data

DNAME DNUMBER DHEAD DLOCATION

CSE 101 Raju Thr

CSE 101 Raju Tvm

IT 102 Ram Thr

ECE 103 Rahul Thr,

ECE 103 Rahul Tvm

Here DNUMBER and DLOCATION is Primary key of DEPARTMENT schema .DNUMBER , DLOCATION is the Partial Key

Page 6: DBMS - FIRST NORMAL FORM

Solution III :-

If maximum number of values is known for the attribute. For example at most three locations can exist for a department. Replace the DLOCATION attribute by three atomic attributes DLOCATION1, DLOCATION2, DLOCATION3. The disadvantage of introducing NULL values if most department have fewer than three locations.

DNAME

DNUMBER

DHEAD

DLOCATION1

DLOCATION2

DLOCATION3

CSE 101 Raju Thr Tvm NULL

IT 102 Ram Thr NULL NULL

ECE 103 Rahul Thr Tvm NULL

Page 7: DBMS - FIRST NORMAL FORM

If queries contact :

Manish T IE-mail: [email protected] [email protected]: 919744603783

Reference:-

Elmasri, Navathe. Fundamentals of Database Systems, Third Edition, Pearson Education, 2000.