E R M O D E L L I N G & D B N O R M A L I Z A T I O N
DATABASE NORMALIZATION
NORMALIZATION
 Process for evaluating and correcting table structures to
minimize data redundancies
 Reduces data Anomalies
 Brings a database to a consistent state
 Works through a series of stages called normal forms:
 First normal form (1NF)
 Second normal form (2NF)
 Third normal form (3NF)
The higher you go the better 3rd normal form is better than 2  2 is
better than 1
REASONS FOR NORMALIZATION
 Data Redundancy
RESONS FOR NORMALIZATION
 Relations become progressively more restricted (stronger)
in format and also less vulnerable to update anomalies.
 One peace of information is stored in one location / place
KEYWORDS
 Determinant  determines the value of other attributes
in the tuples.
 Functional Dependency Describes relationship
between attributes in a relation.
EXAMPLE OF DATABASE ANOMALIES
 Update Anomalies
 Delete Anomalies
 Insert Anomalies
UPDATE ANOMALIES
 Occurs when data is scattered
 Not linked together properly
 Leaves database inconsistent
DELETE ANOMALIES
 Parts of data not deleted
 Unawareness
INSERT ANORMALIES
 Insert Data in a record that does not exist
FIRST NORMAL FORM
 All attributes in a relation must have atomic
domains
 Purpose is to remove repeating groups in relation
 Each row and column contains one and only one
value
 Gets rid of extra , make data as small as it can get
 All key attributes are defined
 No repeating column
FIRST NORMAL FORM
 Rearrange the table to convert to First normal form
Each
attribute
must
contain
only one
single
value
form its
predefine
d
domain.
EXAMPLE 2
 What's the wrong with the table?
COLUMNS REMOVED
 1st Normal form
Primary Key
SECOND NORMAL FORM
 Remove partial dependencies
 Every non-primary-key attribute is fully functionally dependent
on the primary key.
 No attribute is dependent on only a portion of primary key
 Key Terms
 Prime Attribute  An attribute which is part of
primary key.
 Non Prime Attribute  Any attribute which is not
part of the primary key.
 Every Non-Prime attribute SHOULD be fully
functionally dependent on the prime key attribute.
 In short Non key attributes should depend on full
primary key
EXAMPLE
 .
EXAMPLE ..SECOND NORM
 The relation is broken into two thereby removing
partial dependency.
EXAMPLE 2
 Person Project
CONTINUATION 2ND NORM
 .
THIRD NORMAL FORM
 All non key attributes should nontransitively
dependent on the primary key.
RESULT
 .

Normalization

  • 1.
    E R MO D E L L I N G & D B N O R M A L I Z A T I O N DATABASE NORMALIZATION
  • 2.
    NORMALIZATION  Process forevaluating and correcting table structures to minimize data redundancies  Reduces data Anomalies  Brings a database to a consistent state  Works through a series of stages called normal forms:  First normal form (1NF)  Second normal form (2NF)  Third normal form (3NF) The higher you go the better 3rd normal form is better than 2  2 is better than 1
  • 3.
  • 4.
    RESONS FOR NORMALIZATION Relations become progressively more restricted (stronger) in format and also less vulnerable to update anomalies.  One peace of information is stored in one location / place
  • 5.
    KEYWORDS  Determinant determines the value of other attributes in the tuples.  Functional Dependency Describes relationship between attributes in a relation.
  • 6.
    EXAMPLE OF DATABASEANOMALIES  Update Anomalies  Delete Anomalies  Insert Anomalies
  • 7.
    UPDATE ANOMALIES  Occurswhen data is scattered  Not linked together properly  Leaves database inconsistent
  • 8.
    DELETE ANOMALIES  Partsof data not deleted  Unawareness
  • 9.
    INSERT ANORMALIES  InsertData in a record that does not exist
  • 10.
    FIRST NORMAL FORM All attributes in a relation must have atomic domains  Purpose is to remove repeating groups in relation  Each row and column contains one and only one value  Gets rid of extra , make data as small as it can get  All key attributes are defined  No repeating column
  • 11.
    FIRST NORMAL FORM Rearrange the table to convert to First normal form Each attribute must contain only one single value form its predefine d domain.
  • 12.
    EXAMPLE 2  What'sthe wrong with the table?
  • 13.
    COLUMNS REMOVED  1stNormal form Primary Key
  • 14.
    SECOND NORMAL FORM Remove partial dependencies  Every non-primary-key attribute is fully functionally dependent on the primary key.  No attribute is dependent on only a portion of primary key  Key Terms  Prime Attribute  An attribute which is part of primary key.  Non Prime Attribute  Any attribute which is not part of the primary key.  Every Non-Prime attribute SHOULD be fully functionally dependent on the prime key attribute.  In short Non key attributes should depend on full primary key
  • 15.
  • 16.
    EXAMPLE ..SECOND NORM The relation is broken into two thereby removing partial dependency.
  • 17.
  • 18.
  • 19.
    THIRD NORMAL FORM All non key attributes should nontransitively dependent on the primary key.
  • 20.

Editor's Notes

  • #6 Determinant of a functional dependency refers to attribute or group of attributes on left-hand side of the arrow.
  • #11 How about time e.g 8:30:22 seconds
  • #14 Emails can also repeat , u can he person email table
  • #20 nontransitively simply means they should be directly dependent on the primary key. Should not be indirectly dependent on the primary key. Nontransitively means DIRECT ..That id if we say X belongs to Y and Y belongs to Z we should store X belongs to Y in anada table and y belongs to Z in anada table.