free video lecture in india
DESCRIPTION
free video lectures for all branchesTRANSCRIPT
![Page 1: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/1.jpg)
Video Lectures for MBA
By:Video.edhole.com
![Page 2: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/2.jpg)
Ch 10, Functional Dependencies and Normal forms
Bernard Chen, Ph.D.
Assistant ProfessorDepartment of Computer Science
University of Central Arkansas
Fall 2011Video.edhole.com
![Page 3: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/3.jpg)
Goodness of relation schemas The grouping of attributes to form
"good" relation schemas
There are two levels: Logical Level --- How users interpret the
relation schemas and the meaning of their attributes
Implementation level --- How the tuples in a base relation are stored and updated
Video.edhole.com
![Page 4: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/4.jpg)
Outline We first discuss informal guidelines for
good relational design Semantics of the Relation Attributes Redundant Information in Tuples and
Update Anomalies Null Values in Tuples
Then we discuss formal concepts of functional dependencies and normal forms
Video.edhole.com
![Page 5: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/5.jpg)
1. Semantics of the Relation Attributes
Semantics of a relation refers to the interpretation of attribute values in a tuple
In general, the easier it is to explain the semantics of the relation, the better the relation schema design will be
Video.edhole.com
![Page 6: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/6.jpg)
1. Semantics of the Relation Attributes
Take a look of the simplified version of COMPANY relation database:
Video.edhole.com
![Page 7: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/7.jpg)
For example
Video.edhole.com
![Page 8: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/8.jpg)
1. Semantics of the Relation Attributes All relation schemas in the example
may be considered as easy to explain and hence good from the standpoint of having clear semantics
Bottom Line: Design a schema that can be explained easily relation by relation. The semantics of attributes should be easy to interpret.
Video.edhole.com
![Page 9: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/9.jpg)
2. Redundant Information in Tuples and Update Anomalies One goal of schema design is to minimize the
storage space
Bad Design:
Video.edhole.com
![Page 10: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/10.jpg)
2. Redundant Information in Tuples and Update Anomalies
The previous example not only waste spaces but also cause some anomalies: Insert Anomaly Delete Anomaly Modify Anomaly
Video.edhole.com
![Page 11: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/11.jpg)
2. Redundant Information in Tuples and Update Anomalies Consider the relation:
Insert Anomaly: For a new employee, you have to assign
NULL to projects Cannot insert a project unless an employee
is assigned to it.
Video.edhole.com
![Page 12: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/12.jpg)
2. Redundant Information in Tuples and Update Anomalies Consider the relation:
Delete Anomaly: If we delete from EMP_DEPT an
employee tuple that happens to represent the last employee, the information containing that department is lost from the database
Video.edhole.com
![Page 13: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/13.jpg)
2. Redundant Information in Tuples and Update Anomalies Consider the relation:
Modify Anomaly: If we change the value of the
manager of department 5, we must update the tuples of all employees who work in the department
Video.edhole.com
![Page 14: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/14.jpg)
2. Redundant Information in Tuples and Update Anomalies
GUIDELINE 2: Design a schema that does not suffer
from the insertion, deletion and update anomalies.
If there are any anomalies present, then note them so that applications can be made to take them into account.
Video.edhole.com
![Page 15: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/15.jpg)
3. Null Values in Tuples As far as possible, avoid placing
attributes in a base relation whose values may frequently be NULL
For example: if only 10% of employees have individual offices, DO NOT include a attribute OFFICE_NUMBER in the EMPLOYEE relation
Rather, a relation EMP_OFFICES(ESSN, OFFICE_NUMBER) can be created. (just like WEAK entity type)
Video.edhole.com
![Page 16: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/16.jpg)
Outline We first discuss informal guidelines
for good relational design Then we discuss formal concepts
of functional dependencies and normal forms - 1NF (First Normal Form) - 2NF (Second Normal Form) - 3NF (Third Normal Form)
Video.edhole.com
![Page 17: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/17.jpg)
Functional Dependency Definition: a Functional Dependency,
denoted by X -> Y holds if whenever two tuples have the same value for X, they must have the same value for Y
Video.edhole.com
![Page 18: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/18.jpg)
Functional Dependency
Written as X -> Y; can be displayed graphically on a relation schema as in Figures. ( denoted by the arrow)
Social security number determines employee name SSN -> ENAME
Video.edhole.com
![Page 19: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/19.jpg)
Functional Dependency Social security number determines
employee name SSN -> ENAME
Project number determines project name and location
PNUMBER -> {PNAME, PLOCATION}
Employee ssn and project number determines the hours per week that the employee works on the project
{SSN, PNUMBER} -> HOURS
Video.edhole.com
![Page 20: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/20.jpg)
Functional Dependency
Bad Design:
Video.edhole.com
![Page 21: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/21.jpg)
Normalization of Relations Normalization:
The process of decomposing unsatisfactory "bad" relations by breaking up their attributes into smaller relations
Normal form: Condition using keys and FDs of a
relation to certify whether a relation schema is in a particular normal form
Video.edhole.com
![Page 22: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/22.jpg)
List of Normal Forms First Normal Form (1NF)
Atomic values
2NF, 3NF based on primary keys
4NF based on keys, multi-valued dependencies
5NF based on keys, join dependencies
Video.edhole.com
![Page 23: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/23.jpg)
Practical Use of Normal Forms Most practical relational design projects
take one of the following two approaches:
Perform a conceptual schema design using a conceptual model (ER, EER) and map the conceptual design into relations
Design the relations based on external knowledge derived from an existing implementation of files (or reports)
Video.edhole.com
![Page 24: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/24.jpg)
Practical Use of Normal Forms Normalization is carried out in practice
so that the resulting designs are of high quality and meet the desirable properties
The database designers need not normalize to the highest possible normal form (usually up to 3NF, BCNF or 4NF)
Video.edhole.com
![Page 25: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/25.jpg)
Definitions of Keys and Attributes Participating in Keys A superkey of a relation schema R = {A1,
A2, ...., An} is a set of attributes S subset-of R with the property that no two tuples t1 and t2 in any legal relation state r of R will have t1[S] = t2[S]
A key K is a superkey with the additional property that removal of any attribute from K will cause K not to be a superkey any more.
Video.edhole.com
![Page 26: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/26.jpg)
Definitions of Keys and Attributes Participating in Keys If a relation schema has more than one
key, each is called a candidate key. One of the candidate keys is arbitrarily
designated to be the primary key
A Prime attribute must be a member of some candidate key
A Nonprime attribute is not a prime attribute—that is, it is not a member of any candidate key.
Video.edhole.com
![Page 27: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/27.jpg)
First Normal Form
Historically, it is designed to disallow composite attributes multivalued attributes Or the combination of both
All the values need to be atomic
Video.edhole.com
![Page 28: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/28.jpg)
First Normal Form
Video.edhole.com
![Page 29: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/29.jpg)
First Normal Form To normalize into 1NF, we have the
following 3 techniques: Remove the attribute Dlocations that violates
1NF and place it in a separate relation Expand the key (10.8 C). In this case, the PK
become the combination of {Dnumber, Dlocation}
If the max number of values is known, then we can replace the violate attribute by the max number atomic attributes, such as, Dlocation1, Dlocation2, Dlocation3…
Video.edhole.com
![Page 30: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/30.jpg)
Second Normal Form
In this example, {Ssn, Pnummber} -> Hours is a fully dependency
However, the dependency {Ssn, Pnumber}->Ename is partial because Ssn->Ename holds
Video.edhole.com
![Page 31: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/31.jpg)
Second Normal Form A relation schema R is in second normal
form (2NF) if every non-prime attribute A in R is fully functionally dependent on the primary key
A functional dependency X->Y is a partial dependency if some attribute A belong X can be removed from X and the dependency still holds
Video.edhole.com
![Page 32: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/32.jpg)
Second Normal Form If the primary key contains a single
attribute, it is 2NF
Normalization into 2NF: If a relation schema is not in 2NF, it can be
normalized into a number of 2NF relations where nonprime attributes are associated with only with the part of the primary key on which they are fully functionally dependent
Video.edhole.com
![Page 33: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/33.jpg)
Second Normal Form
Video.edhole.com
![Page 34: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/34.jpg)
Third Normal Form
A relation schema R is in third normal form (3NF) if it is in 2NF and no non-prime attribute A in R is transitively dependent on the primary key
Transitive functional dependency: a FD X -> Z that can be derived from two FDs X -> Y and Y -> Z
Video.edhole.com
![Page 35: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/35.jpg)
Third Normal Form
Examples: SSN -> DMGRSSN is a transitive FD
Since SSN -> DNUMBER and DNUMBER -> DMGRSSN hold
SSN -> ENAME is non-transitive Since there is no set of attributes X where
SSN -> X and X -> ENAME
Video.edhole.com
![Page 36: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/36.jpg)
Third Normal Form
Video.edhole.com
![Page 37: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/37.jpg)
Normal Forms Defined Informally
1st normal form All attributes depend on the key
2nd normal form All attributes depend on the whole
key 3rd normal form
All attributes depend on nothing but the key
Video.edhole.com
![Page 38: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/38.jpg)
SUMMARY OF NORMAL FORMS based on Primary Keys
Video.edhole.com
![Page 39: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/39.jpg)
Practice
Based on the given primary key, is this relation in 1NF, 2NF, or 3NF? Why or why not? How would you successively normalize it completely?
Video.edhole.com
![Page 40: free Video lecture in India](https://reader036.vdocuments.net/reader036/viewer/2022062614/54663518af795937498b6d54/html5/thumbnails/40.jpg)
Video.edhole.com