SlideShare a Scribd company logo
1 of 61
Download to read offline
Functional
Dependencies
prepared by Visakh V,Assistant
Professor,LBSITW
There are two levels at which we discuss the goodness of
relation schema
•Logical (or Conceptual)Level
•Implementation (or storage ) Level
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
4 Informal measures of quality for
relation schemas are
I. Semantics of the attribute
• interpretation of attribute values
from tuples
• The attribute belonging to one relation
have certain real-world meaning and a
proper interpretation associated with
them
prepared by Visakh V,Assistant
Professor,LBSITW
ii. Reducing redundant information in tuples
• minimize the storage space used by the base
relation
• Problem of update anomalies
• Insertion of anomalies
• Deletion of anomalies
• Modification of anomalies
iii. Reducing the NULL values in the tuples
• Waste space at storage levels
• Also lead to problems with understanding
the meaning of attributes (ex:count,join )
iv. Disallowing the possibility of generating
spurious tuples
• Seems to be genuine but it is falseprepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
• Most important concept in relational schema design
theory.
• A functional dependency is a constraint between
two set of attributes from the database.
• it is denoted by X  Y(functional dependency
from x to y or y is functionally dependent on X.)
• i.e. Y component of a tuple in r depend on , or are
determined by , the values of the Y component.
•A functional dependency is a property of the of the
semantics or meaning .prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
Inference ???
•Dept_no  Mgr_SSN , each department has one manager
• Mgr_SSN  Mgr_phone : Each manager has a unique phone number
• then we can infer Dept_no  Mgr_phone
prepared by Visakh V,Assistant
Professor,LBSITW
Closure : includes all dependencies that can
be inferred from the given set F, it is denoted
by F
closure ???
+
Let us see some examples on board
prepared by Visakh V,Assistant
Professor,LBSITW
The notation F XY means the functional
dependency XY is inferred from functional
dependencies F.
To determine a systematic way to infer dependencies,
we use inference rules that can be used to infer new
dependencies
prepared by Visakh V,Assistant
Professor,LBSITW
Inference rules for functional dependencies are :
• IR1 (reflexive rule) : If Y subset-of X,
then X  Y
•IR2 (augmentation rule) : If X -> Y, then XZ -> YZ
•IR3 (transitive rule) :If X Y & Y Z, then
X  Z
•IR4 (decomposition ,or projective rule) : If X YZ then X Y
•IR5 (Union or additive rule) : If XY,XZ then XYZ
•IR6 (pseudo transitive rule) : If XY,WYZ then
WX  Z
Trivial
otherwise
Non-Trivial
prepared by Visakh V,Assistant
Professor,LBSITW
Inference rules IR1 through IR3
are sound and complete
Dependency that we
can infer from F by
using IR1 to IR3 holds
every relation state r
of R that satisfies the
dependencies in F.
Using IR1to IR3
repeatedly to infer
dependencies until no
more dependencies
can be inferred from F
The closure of F , can be determined from F by using
inference rules IR1 to IR3 are known as Armstrong ‘s
inference rules.
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
Cover : A set of functional dependencies F is said
to cover another set of dependencies E if every
FD in E is also in F .
Or we can say that E is covered by F.
+
Two sets of functional dependencies E and F are
equivalent if E = F .+ +
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
Minimal cover : minimal cover of a functional dependencies E
is a set functional dependencies F that satisfies the property
that every dependency in E is in the closure of F of F.+
•Every set of FDs has an equivalent minimal set
•There can be several equivalent minimal sets
•There is no simple algorithm for computing a minimal
set of FDs that is equivalent to a set F of FDs
•To synthesize a set of relations, we assume that we
start with a set of dependencies that is a minimal set
prepared by Visakh V,Assistant
Professor,LBSITW
• Set F:= E
• Replace each functional dependencies X{A1,A2,. . . .,An}
in F by the n functional dependencies X A1,XA2,. ..
.,XAn.
• For each functional dependencies X A in
For each attribute B that is an element of X
• if {F – {XA}} U {(x-{B}) a} }
Algorithm
Finding a Minimal cover F for a set of functional dependencies E
CANONICAL formprepared by Visakh V,Assistant
Professor,LBSITW
Find minimum cover for E
{B A, DA,ABD}
Find minimum cover for E
{AD,BCA,BCD,CB,EA,ED}
Find minimum cover for E
{ AB -> C, C -> A, BC -> D, ACD -> B, D -> E, D ->
G, BE -> C, CG -> B, CG -> D, CE -> A, CE -> G}
prepared by Visakh V,Assistant
Professor,LBSITW
Find minimum cover for E
{noname
noage
no,nameage
noage,name}
prepared by Visakh V,Assistant
Professor,LBSITW
NORMAL
FORMS
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
•First proposed by Codd (1972)
•Initially proposed first ,second and
3NF
• later Boyce and Codd proposed
BCNF
• later 4th and 5th NF are proposed
based on the concept of multi-
valued dependency and join
dependencies
prepared by Visakh V,Assistant
Professor,LBSITW
Advantages
•Minimizing redundancy
•Minimizing insertion , deletion, and
modification of anomalies
Normal form a relation refers to the highest
normal form condition that it meets, and hence
indicate the degree to which it has been
normalized prepared by Visakh V,Assistant
Professor,LBSITW
Non-prime attribute
A non-prime attribute is an attribute that does not occur in any
candidate key.
Prime attribute
A prime attribute, conversely, is an attribute that does occur in
some candidate key.
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
•Disallow multi valued attributes and composite attributes
• it states that domain of an attributes must include only
atomic (simple, indivisible)values.
•Ex: address
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
Partial key
prepared by Visakh V,Assistant
Professor,LBSITW
Must be in 1NF
prepared by Visakh V,Assistant
Professor,LBSITW
Full functional dependency : A functional dependency X Y is a
FULL FUNCTIONAL dependency if removal of any attribute A from X
means that dependency does not hold any more;
Partial dependency : A functional dependency X Y is a partial
dependency if some attribute A in X can be removed from X and
dependency still holds
Def : A relation schema R is in 2NF if every non
prime attribute A in R is fully functionally
dependent on the primary key of R
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
•it must be in 2NF
Def : A Relation Schema R is in 3nF ,
Whenever a non-trivial functional
dependency holds in R ,either
(a)X is a super key of R or (b) A is a
prime attribute of R
X A
prepared by Visakh V,Assistant
Professor,LBSITW
X A If A is non prime attribute
then X must be super key
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
Def : A Relation Schema R is in BCNF ,
Whenever a non-trvial functional
dependency holds in R , X is a
superkey
X A
prepared by Visakh V,Assistant
Professor,LBSITW
More stricter than 3NF
X A Always the left hand side
must be super key
whether A is prime or non
prime
prepared by Visakh V,Assistant
Professor,LBSITW
Here {student, course  instructor}
{instructor course}
It is 3NF but not BCNF
prepared by Visakh V,Assistant
Professor,LBSITW
In BCNF must check TWO conditions
• X Y allowed ,if it is trivial functional dependency
OR
• X is a super key for schema R
BCNF is
More stricter than 3NF
prepared by Visakh V,Assistant
Professor,LBSITW
A 3NF table which does not have
multiple overlapping candidate keys
is guaranteed to be in BCNF
Ex: 3NF but not BCNF
Court Start Time End Time Rate Type
1 09:30 10:00 SAVER
1 11:00 12:00 SAVER
1 14:00 15:30 STANDARD
2 10:00 11:30 PREMIUM-B
2 11:30 13:30 PREMIUM-B
2 15:00 16:30 PREMIUM-A
2 9:30 10:00 PREMIUM-A
prepared by Visakh V,Assistant
Professor,LBSITW
Here the candidate keys are
S1: {COURT,START TIME}
S2:{COURT,END TIME}
S3:{RATE TYPE,START TIME}
S4:{RATE TYPE, END TIME}
Here no non prime attributes , all are prime attribute
belongs to some candidate key.
So the table is 2NF and 3NF.but not in BCNF.prepared by Visakh V,Assistant
Professor,LBSITW
Here no non prime attributes , all are prime attribute
belongs to some candidate key.
So the table is 2NF and 3NF,but not in BCNF because of
rate type  court.
prepared by Visakh V,Assistant
Professor,LBSITW
Today's Bookings
Rate Type Start Time End Time
SAVER 09:30 10:30
SAVER 11:00 12:00
STANDARD 14:00 15:30
PREMIUM-B 10:00 11:30
PREMIUM-B 11:30 13:30
PREMIUM-A 15:00 16:30
Rate Types
Rate Type Court Member Flag
SAVER 1 Yes
STANDARD 1 No
PREMIUM-A 2 Yes
PREMIUM-B 2 No
Now it is in BCNF
prepared by Visakh V,Assistant
Professor,LBSITW
Problems when using BCNF
Person Shop Type Nearest Shop
Teena Optician Eagle Eye
Meenu Hairdresser Snippets
Priya Bookshop Merlin Books
Sreedevi Bakery Sree bakers
Sreedevi Hairdresser Sweeney
Sreedevi Optician Eagle Eye
Dependency:
A, B  C
C  B
Not BCNFprepared by Visakh V,Assistant
Professor,LBSITW
Shop Near Person
Person Shop
Teena Eagle Eye
Meenu Snippets
Priya Merlin Books
Sreedevi Sree Bakers
Sreedevi Sweeney
Sreedevi Eagle Eye
Shop
Shop Shop Type
Eagle Eye Optician
Snippets Hairdresser
Merlin Books Bookshop
Sree Bakers Bakery
Sweeney Hairdresser
prepared by Visakh V,Assistant
Professor,LBSITW
Problem : It allow us to record data such as,a
person’s multiple shops with same type ,It
violates the dependency
{person,shoptype}{shop}
So BCNF is not always possible
prepared by Visakh V,Assistant
Professor,LBSITW
(Lets do some problems)
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
MULTIVALUED DEPENDENCY
: A consequence of first normal form, Which disallows an attribute
have a set of values
: A multivalued dependency is a special case of a join dependency,
Course Book Lecturer
AHA Silberschatz John D
AHA Nederpelt William M
AHA Silberschatz William M
AHA Nederpelt John D
AHA Silberschatz Christian G
AHA Nederpelt Christian G
OSO Silberschatz John D
OSO Silberschatz William M
{course} {book}
and equivalently
{course}  {lecturer}.
prepared by Visakh V,Assistant
Professor,LBSITW
Definition for 4th Normal Form
A relation schema R is in 4NF with respect to a set
of dependencies F (that include functional
dependencies and multivalued dependencies ),if for
every non trivial multivalued dependency X Y
in F closure,X is a super key of R.
A trivial multivalued dependency X  Y is one
where either Y is a subset of X, or X and Y together
form the whole set of attributes of the relation.
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
prepared by Visakh V,Assistant
Professor,LBSITW
•In dependency theory, a join dependency is a
constraint on the set of legal relations over a
database scheme.
• A table T is subject to a join dependency if T can
always be recreated by joining multiple tables
each having a subset of the attributes of T.
• If one of the tables in the join has all the
attributes of the table T, the join dependency is
called trivial
prepared by Visakh V,Assistant
Professor,LBSITW
•If JOIN dependency is present carry out a
multiway decomposition in to 5th Normal
form
•Such dependency is very peculiar semantic
constraint, that is very difficult to detect I
practice. So 5NF very rarely done in practice.
prepared by Visakh V,Assistant
Professor,LBSITW
NON ADDITIVE (LOSELESS) JOIN DEPENDENCY
•Which ensures that no spurious tuples are generated
when a NATURAL JOIN operation is applied to the
relations in the decomposition
• lossless refers to loss information ,not to loss of
tuples.
prepared by Visakh V,Assistant
Professor,LBSITW
Example of lossy decomposition
A B C
1 1 1
1 1 2
1 2 1
A B C
1 1 1
1 1 2
1 2 1
1 2 2
A B
1 1
1 2
A C
1 1
1 2
Original table Decomposition
Reconstruction
prepared by Visakh V,Assistant
Professor,LBSITW

More Related Content

What's hot

Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalizationdaxesh chauhan
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
 
Advantages and disadvantages of relational databases
Advantages and disadvantages of relational databasesAdvantages and disadvantages of relational databases
Advantages and disadvantages of relational databasesSanthiNivas
 
Relational algebra operations
Relational algebra operationsRelational algebra operations
Relational algebra operationsSanthiNivas
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMSkoolkampus
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationUniversity of Potsdam
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...Raj vardhan
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra pptGirdharRatne
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimizationlavanya marichamy
 

What's hot (20)

Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 
C++ chapter 1
C++ chapter 1C++ chapter 1
C++ chapter 1
 
Advantages and disadvantages of relational databases
Advantages and disadvantages of relational databasesAdvantages and disadvantages of relational databases
Advantages and disadvantages of relational databases
 
Relational algebra operations
Relational algebra operationsRelational algebra operations
Relational algebra operations
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
3. Relational Models in DBMS
3. Relational Models in DBMS3. Relational Models in DBMS
3. Relational Models in DBMS
 
Joins in dbms and types
Joins in dbms and typesJoins in dbms and types
Joins in dbms and types
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
 
Lossless decomposition
Lossless decompositionLossless decomposition
Lossless decomposition
 
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Query evaluation and optimization
Query evaluation and optimizationQuery evaluation and optimization
Query evaluation and optimization
 
joins in database
 joins in database joins in database
joins in database
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
Join dependency
Join dependencyJoin dependency
Join dependency
 

Similar to Functional dependency and normalization

Similar to Functional dependency and normalization (15)

Relational algebra complete
Relational algebra completeRelational algebra complete
Relational algebra complete
 
Normalisation
NormalisationNormalisation
Normalisation
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
Normalization
NormalizationNormalization
Normalization
 
Lecture No. 21-22.ppt
Lecture No. 21-22.pptLecture No. 21-22.ppt
Lecture No. 21-22.ppt
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
 
DBMS.ppt
DBMS.pptDBMS.ppt
DBMS.ppt
 
BCNF V/S 3NF
BCNF V/S 3NFBCNF V/S 3NF
BCNF V/S 3NF
 
Normalization
NormalizationNormalization
Normalization
 
Normalization1
Normalization1Normalization1
Normalization1
 
Final exam in advance dbms
Final exam in advance dbmsFinal exam in advance dbms
Final exam in advance dbms
 
Unit05 dbms
Unit05 dbmsUnit05 dbms
Unit05 dbms
 
Dbms unit-3
Dbms unit-3Dbms unit-3
Dbms unit-3
 
UNIT-IV.ppt
UNIT-IV.pptUNIT-IV.ppt
UNIT-IV.ppt
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 

More from Visakh V

Data base recovery
Data base recoveryData base recovery
Data base recoveryVisakh V
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms usersVisakh V
 
Transaction Management
Transaction Management Transaction Management
Transaction Management Visakh V
 
Memory Management
Memory ManagementMemory Management
Memory ManagementVisakh V
 
Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keysVisakh V
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms usersVisakh V
 
Slide 6 er strong & weak entity
Slide 6 er  strong & weak entitySlide 6 er  strong & weak entity
Slide 6 er strong & weak entityVisakh V
 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaVisakh V
 
Slide 2 data models
Slide 2 data modelsSlide 2 data models
Slide 2 data modelsVisakh V
 
Slide 1 introduction to dbms
Slide 1 introduction to dbmsSlide 1 introduction to dbms
Slide 1 introduction to dbmsVisakh V
 
Relational algebr
Relational algebrRelational algebr
Relational algebrVisakh V
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by Visakh V
 

More from Visakh V (13)

Data base recovery
Data base recoveryData base recovery
Data base recovery
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms users
 
Transaction Management
Transaction Management Transaction Management
Transaction Management
 
Memory Management
Memory ManagementMemory Management
Memory Management
 
Slide 5 keys
Slide 5 keysSlide 5 keys
Slide 5 keys
 
Slide 4 dbms users
Slide 4 dbms usersSlide 4 dbms users
Slide 4 dbms users
 
Slide 6 er strong & weak entity
Slide 6 er  strong & weak entitySlide 6 er  strong & weak entity
Slide 6 er strong & weak entity
 
Slide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schemaSlide 3 data abstraction & 3 schema
Slide 3 data abstraction & 3 schema
 
Slide 2 data models
Slide 2 data modelsSlide 2 data models
Slide 2 data models
 
Slide 1 introduction to dbms
Slide 1 introduction to dbmsSlide 1 introduction to dbms
Slide 1 introduction to dbms
 
Data
DataData
Data
 
Relational algebr
Relational algebrRelational algebr
Relational algebr
 
data constraints,group by
data constraints,group by data constraints,group by
data constraints,group by
 

Recently uploaded

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 

Recently uploaded (20)

VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 

Functional dependency and normalization

  • 1. Functional Dependencies prepared by Visakh V,Assistant Professor,LBSITW
  • 2. There are two levels at which we discuss the goodness of relation schema •Logical (or Conceptual)Level •Implementation (or storage ) Level prepared by Visakh V,Assistant Professor,LBSITW
  • 3. prepared by Visakh V,Assistant Professor,LBSITW
  • 4. 4 Informal measures of quality for relation schemas are I. Semantics of the attribute • interpretation of attribute values from tuples • The attribute belonging to one relation have certain real-world meaning and a proper interpretation associated with them prepared by Visakh V,Assistant Professor,LBSITW
  • 5. ii. Reducing redundant information in tuples • minimize the storage space used by the base relation • Problem of update anomalies • Insertion of anomalies • Deletion of anomalies • Modification of anomalies iii. Reducing the NULL values in the tuples • Waste space at storage levels • Also lead to problems with understanding the meaning of attributes (ex:count,join ) iv. Disallowing the possibility of generating spurious tuples • Seems to be genuine but it is falseprepared by Visakh V,Assistant Professor,LBSITW
  • 6. prepared by Visakh V,Assistant Professor,LBSITW
  • 7. prepared by Visakh V,Assistant Professor,LBSITW
  • 8. prepared by Visakh V,Assistant Professor,LBSITW
  • 9. • Most important concept in relational schema design theory. • A functional dependency is a constraint between two set of attributes from the database. • it is denoted by X  Y(functional dependency from x to y or y is functionally dependent on X.) • i.e. Y component of a tuple in r depend on , or are determined by , the values of the Y component. •A functional dependency is a property of the of the semantics or meaning .prepared by Visakh V,Assistant Professor,LBSITW
  • 10. prepared by Visakh V,Assistant Professor,LBSITW
  • 11. Inference ??? •Dept_no  Mgr_SSN , each department has one manager • Mgr_SSN  Mgr_phone : Each manager has a unique phone number • then we can infer Dept_no  Mgr_phone prepared by Visakh V,Assistant Professor,LBSITW
  • 12. Closure : includes all dependencies that can be inferred from the given set F, it is denoted by F closure ??? + Let us see some examples on board prepared by Visakh V,Assistant Professor,LBSITW
  • 13. The notation F XY means the functional dependency XY is inferred from functional dependencies F. To determine a systematic way to infer dependencies, we use inference rules that can be used to infer new dependencies prepared by Visakh V,Assistant Professor,LBSITW
  • 14. Inference rules for functional dependencies are : • IR1 (reflexive rule) : If Y subset-of X, then X  Y •IR2 (augmentation rule) : If X -> Y, then XZ -> YZ •IR3 (transitive rule) :If X Y & Y Z, then X  Z •IR4 (decomposition ,or projective rule) : If X YZ then X Y •IR5 (Union or additive rule) : If XY,XZ then XYZ •IR6 (pseudo transitive rule) : If XY,WYZ then WX  Z Trivial otherwise Non-Trivial prepared by Visakh V,Assistant Professor,LBSITW
  • 15. Inference rules IR1 through IR3 are sound and complete Dependency that we can infer from F by using IR1 to IR3 holds every relation state r of R that satisfies the dependencies in F. Using IR1to IR3 repeatedly to infer dependencies until no more dependencies can be inferred from F The closure of F , can be determined from F by using inference rules IR1 to IR3 are known as Armstrong ‘s inference rules. prepared by Visakh V,Assistant Professor,LBSITW
  • 16. prepared by Visakh V,Assistant Professor,LBSITW
  • 17. Cover : A set of functional dependencies F is said to cover another set of dependencies E if every FD in E is also in F . Or we can say that E is covered by F. + Two sets of functional dependencies E and F are equivalent if E = F .+ + prepared by Visakh V,Assistant Professor,LBSITW
  • 18. prepared by Visakh V,Assistant Professor,LBSITW
  • 19. Minimal cover : minimal cover of a functional dependencies E is a set functional dependencies F that satisfies the property that every dependency in E is in the closure of F of F.+ •Every set of FDs has an equivalent minimal set •There can be several equivalent minimal sets •There is no simple algorithm for computing a minimal set of FDs that is equivalent to a set F of FDs •To synthesize a set of relations, we assume that we start with a set of dependencies that is a minimal set prepared by Visakh V,Assistant Professor,LBSITW
  • 20. • Set F:= E • Replace each functional dependencies X{A1,A2,. . . .,An} in F by the n functional dependencies X A1,XA2,. .. .,XAn. • For each functional dependencies X A in For each attribute B that is an element of X • if {F – {XA}} U {(x-{B}) a} } Algorithm Finding a Minimal cover F for a set of functional dependencies E CANONICAL formprepared by Visakh V,Assistant Professor,LBSITW
  • 21. Find minimum cover for E {B A, DA,ABD} Find minimum cover for E {AD,BCA,BCD,CB,EA,ED} Find minimum cover for E { AB -> C, C -> A, BC -> D, ACD -> B, D -> E, D -> G, BE -> C, CG -> B, CG -> D, CE -> A, CE -> G} prepared by Visakh V,Assistant Professor,LBSITW
  • 22. Find minimum cover for E {noname noage no,nameage noage,name} prepared by Visakh V,Assistant Professor,LBSITW
  • 23. NORMAL FORMS prepared by Visakh V,Assistant Professor,LBSITW
  • 24. prepared by Visakh V,Assistant Professor,LBSITW
  • 25. •First proposed by Codd (1972) •Initially proposed first ,second and 3NF • later Boyce and Codd proposed BCNF • later 4th and 5th NF are proposed based on the concept of multi- valued dependency and join dependencies prepared by Visakh V,Assistant Professor,LBSITW
  • 26. Advantages •Minimizing redundancy •Minimizing insertion , deletion, and modification of anomalies Normal form a relation refers to the highest normal form condition that it meets, and hence indicate the degree to which it has been normalized prepared by Visakh V,Assistant Professor,LBSITW
  • 27. Non-prime attribute A non-prime attribute is an attribute that does not occur in any candidate key. Prime attribute A prime attribute, conversely, is an attribute that does occur in some candidate key. prepared by Visakh V,Assistant Professor,LBSITW
  • 28. prepared by Visakh V,Assistant Professor,LBSITW
  • 29. •Disallow multi valued attributes and composite attributes • it states that domain of an attributes must include only atomic (simple, indivisible)values. •Ex: address prepared by Visakh V,Assistant Professor,LBSITW
  • 30. prepared by Visakh V,Assistant Professor,LBSITW
  • 31. Partial key prepared by Visakh V,Assistant Professor,LBSITW
  • 32. Must be in 1NF prepared by Visakh V,Assistant Professor,LBSITW
  • 33. Full functional dependency : A functional dependency X Y is a FULL FUNCTIONAL dependency if removal of any attribute A from X means that dependency does not hold any more; Partial dependency : A functional dependency X Y is a partial dependency if some attribute A in X can be removed from X and dependency still holds Def : A relation schema R is in 2NF if every non prime attribute A in R is fully functionally dependent on the primary key of R prepared by Visakh V,Assistant Professor,LBSITW
  • 34. prepared by Visakh V,Assistant Professor,LBSITW
  • 35. prepared by Visakh V,Assistant Professor,LBSITW
  • 36. •it must be in 2NF Def : A Relation Schema R is in 3nF , Whenever a non-trivial functional dependency holds in R ,either (a)X is a super key of R or (b) A is a prime attribute of R X A prepared by Visakh V,Assistant Professor,LBSITW
  • 37. X A If A is non prime attribute then X must be super key prepared by Visakh V,Assistant Professor,LBSITW
  • 38. prepared by Visakh V,Assistant Professor,LBSITW
  • 39. Def : A Relation Schema R is in BCNF , Whenever a non-trvial functional dependency holds in R , X is a superkey X A prepared by Visakh V,Assistant Professor,LBSITW
  • 40. More stricter than 3NF X A Always the left hand side must be super key whether A is prime or non prime prepared by Visakh V,Assistant Professor,LBSITW
  • 41. Here {student, course  instructor} {instructor course} It is 3NF but not BCNF prepared by Visakh V,Assistant Professor,LBSITW
  • 42. In BCNF must check TWO conditions • X Y allowed ,if it is trivial functional dependency OR • X is a super key for schema R BCNF is More stricter than 3NF prepared by Visakh V,Assistant Professor,LBSITW
  • 43. A 3NF table which does not have multiple overlapping candidate keys is guaranteed to be in BCNF Ex: 3NF but not BCNF Court Start Time End Time Rate Type 1 09:30 10:00 SAVER 1 11:00 12:00 SAVER 1 14:00 15:30 STANDARD 2 10:00 11:30 PREMIUM-B 2 11:30 13:30 PREMIUM-B 2 15:00 16:30 PREMIUM-A 2 9:30 10:00 PREMIUM-A prepared by Visakh V,Assistant Professor,LBSITW
  • 44. Here the candidate keys are S1: {COURT,START TIME} S2:{COURT,END TIME} S3:{RATE TYPE,START TIME} S4:{RATE TYPE, END TIME} Here no non prime attributes , all are prime attribute belongs to some candidate key. So the table is 2NF and 3NF.but not in BCNF.prepared by Visakh V,Assistant Professor,LBSITW
  • 45. Here no non prime attributes , all are prime attribute belongs to some candidate key. So the table is 2NF and 3NF,but not in BCNF because of rate type  court. prepared by Visakh V,Assistant Professor,LBSITW
  • 46. Today's Bookings Rate Type Start Time End Time SAVER 09:30 10:30 SAVER 11:00 12:00 STANDARD 14:00 15:30 PREMIUM-B 10:00 11:30 PREMIUM-B 11:30 13:30 PREMIUM-A 15:00 16:30 Rate Types Rate Type Court Member Flag SAVER 1 Yes STANDARD 1 No PREMIUM-A 2 Yes PREMIUM-B 2 No Now it is in BCNF prepared by Visakh V,Assistant Professor,LBSITW
  • 47. Problems when using BCNF Person Shop Type Nearest Shop Teena Optician Eagle Eye Meenu Hairdresser Snippets Priya Bookshop Merlin Books Sreedevi Bakery Sree bakers Sreedevi Hairdresser Sweeney Sreedevi Optician Eagle Eye Dependency: A, B  C C  B Not BCNFprepared by Visakh V,Assistant Professor,LBSITW
  • 48. Shop Near Person Person Shop Teena Eagle Eye Meenu Snippets Priya Merlin Books Sreedevi Sree Bakers Sreedevi Sweeney Sreedevi Eagle Eye Shop Shop Shop Type Eagle Eye Optician Snippets Hairdresser Merlin Books Bookshop Sree Bakers Bakery Sweeney Hairdresser prepared by Visakh V,Assistant Professor,LBSITW
  • 49. Problem : It allow us to record data such as,a person’s multiple shops with same type ,It violates the dependency {person,shoptype}{shop} So BCNF is not always possible prepared by Visakh V,Assistant Professor,LBSITW
  • 50. (Lets do some problems) prepared by Visakh V,Assistant Professor,LBSITW
  • 51. prepared by Visakh V,Assistant Professor,LBSITW
  • 52. MULTIVALUED DEPENDENCY : A consequence of first normal form, Which disallows an attribute have a set of values : A multivalued dependency is a special case of a join dependency, Course Book Lecturer AHA Silberschatz John D AHA Nederpelt William M AHA Silberschatz William M AHA Nederpelt John D AHA Silberschatz Christian G AHA Nederpelt Christian G OSO Silberschatz John D OSO Silberschatz William M {course} {book} and equivalently {course}  {lecturer}. prepared by Visakh V,Assistant Professor,LBSITW
  • 53. Definition for 4th Normal Form A relation schema R is in 4NF with respect to a set of dependencies F (that include functional dependencies and multivalued dependencies ),if for every non trivial multivalued dependency X Y in F closure,X is a super key of R. A trivial multivalued dependency X  Y is one where either Y is a subset of X, or X and Y together form the whole set of attributes of the relation. prepared by Visakh V,Assistant Professor,LBSITW
  • 54. prepared by Visakh V,Assistant Professor,LBSITW
  • 55. prepared by Visakh V,Assistant Professor,LBSITW
  • 56. prepared by Visakh V,Assistant Professor,LBSITW
  • 57. prepared by Visakh V,Assistant Professor,LBSITW
  • 58. •In dependency theory, a join dependency is a constraint on the set of legal relations over a database scheme. • A table T is subject to a join dependency if T can always be recreated by joining multiple tables each having a subset of the attributes of T. • If one of the tables in the join has all the attributes of the table T, the join dependency is called trivial prepared by Visakh V,Assistant Professor,LBSITW
  • 59. •If JOIN dependency is present carry out a multiway decomposition in to 5th Normal form •Such dependency is very peculiar semantic constraint, that is very difficult to detect I practice. So 5NF very rarely done in practice. prepared by Visakh V,Assistant Professor,LBSITW
  • 60. NON ADDITIVE (LOSELESS) JOIN DEPENDENCY •Which ensures that no spurious tuples are generated when a NATURAL JOIN operation is applied to the relations in the decomposition • lossless refers to loss information ,not to loss of tuples. prepared by Visakh V,Assistant Professor,LBSITW
  • 61. Example of lossy decomposition A B C 1 1 1 1 1 2 1 2 1 A B C 1 1 1 1 1 2 1 2 1 1 2 2 A B 1 1 1 2 A C 1 1 1 2 Original table Decomposition Reconstruction prepared by Visakh V,Assistant Professor,LBSITW