Presentation is loading. Please wait.

Presentation is loading. Please wait.

Logical Database Design and Relational Data Model Muhammad Nasir

Similar presentations


Presentation on theme: "Logical Database Design and Relational Data Model Muhammad Nasir"— Presentation transcript:

1 Logical Database Design and Relational Data Model Muhammad Nasir m.nasir@iiu.edu.pk

2 Contents Normalization Definitions Goals in Normalization 1NF 2NF 3NF

3 Introduction To Normalization Normalization The process of decomposing relations with anomalies to produce smaller, well- structured relations

4 Introduction To Normalization Normal form A state of a relation that requires that certain rules regarding relationships between attributes (or functional dependencies) are satisfied

5 Goals in Normalization 1. Minimize data redundancy, thereby avoiding anomalies and conserving storage space 2. Simplify the enforcement of referential integrity constraints 3. Make it easier to maintain data (insert, update, and delete) 4. Provide a better design that is an improved representation of the real world

6 Steps in Normalization 1. First normal form Any multi-valued attributes (also called repeating groups) have been removed, so there is a single value (possibly null) at the intersection of each row and column of the table 2. Second normal form Any partial functional dependencies have been removed (i.e., non-key attributes are identified by the whole primary key).

7 Steps in Normalization 3. Third normal form Any transitive dependencies have been removed (i.e., non-key attributes are identified by only the primary key). 4. Boyce-Codd normal form Any remaining anomalies that result from functional dependencies have been removed (because there was more than one possible primary key for the same non-keys). 5. Fourth normal form Any multi-valued dependencies have been removed. 6. Fifth normal form Any remaining anomalies have been removed.

8 Steps in Normalization

9 Normalization Functional Dependency A constraint between two attributes in which the value of one attribute is determined by the value of another attribute

10 Normalization 1. SSN →Name, Address, Birth-date A person’s name, address, and birth date are functionally dependent on that person’s Social Security number (in other words, there can be only one Name, one Address, and one Birth-date for each SSN). 2. VIN → Make, Model, Color The make, model, and color of a vehicle are functionally dependent on the vehicle identification number (as above, there can be only one value of Make, Model, and Color associated with each VIN). 3. ISBN → Title, FirstAuthorName, Publisher The title of a book, the name of the first author, and the publisher are functionally dependent on the book’s international standard book number (ISBN).

11 Definitions Determinant The attribute on the left side of the arrow in a functional dependency Candidate key An attribute, or combination of attributes, that uniquely identifies a row in a relation

12 Candidate key A candidate key must satisfy the following 1. Unique identification For every row, the value of the key must uniquely identify that row. This property implies that each non-key attribute is functionally dependent on that key. 2. Non-Redundancy No attribute in the key can be deleted without destroying the property of unique identification

13 Functional Dependency

14 Step 1: Convert to First Normal Form 1. There are no repeating groups in the relation (thus, there is a single fact at the intersection of each row and column of the table). 2. A primary key has been defined, which uniquely identifies each row in the relation.

15 Step 2: Convert to Second Normal Form Second normal form (2NF) A relation in first normal form in which every non-key attribute is fully functionally dependent on the primary key Partial functional dependency A functional dependency in which one or more non-key attributes are functionally dependent on part (but not all) of the primary key

16 Invoice

17 Step 3: Convert to Third Normal Form Third normal form (3NF) A relation that is in second normal form and has no transitive dependencies Transitive dependency A functional dependency between the primary key and one or more non-key attributes that are dependent on the primary key via another non-key attribute

18 REMOVING TRANSITIVE DEPENDENCIES You can easily remove transitive dependencies from a relation by means of a three-step procedure: 1. For each non-key attribute (or set of attributes) that is a determinant in a relation, create a new relation. That attribute (or set of attributes) becomes the primary key of the new relation. 2. Move all of the attributes that are functionally dependent on the primary key of the new relation from the old to the new relation. 3. Leave the attribute that serves as a primary key in the new relation in the old relation to serve as a foreign key that allows you to associate the two relations.

19 Step 3: Convert to Third Normal Form

20

21 The End Thanks for listening Questions would be appreciated.


Download ppt "Logical Database Design and Relational Data Model Muhammad Nasir"

Similar presentations


Ads by Google