SlideShare a Scribd company logo
Prepared by:
RAJ NAIK
SY CE-1
150410107053
 Fuctional dependencies play a key role in differentiating
good database designs from bad database designs.
 Let R be a relation schema,
α  R and β  R
 The functional dependency
α  β
holds on R if and only if for any legal relations
r(R), whenever any two tuples t1 and t2 of R agree on the
attributes α, they also agree on the attributes β. That
is,
 t1 [α] = t2 [α]  t1 [β] = t2 [β ]
 Example:
Consider r(A,B) with the following instance of r.
 On this instance, A  B does NOT hold, but B  A does
hold.
 A functional dependency is a generalization of the notion
of a key
1 4
1 7
4 6
 K is a superkey or for relation schema R if and only if K
 R
 K is a candidate key for R if and only if
K  R, and
for no α  K, α  R
 Functional dependencies allow us to express
constraints that cannot be expressed using superkeys.
Consider the schema:
inst_dept (ID, name, salary, dept_name, building,
budget )
 We expect these functional dependencies to hold:
dept_name  building
ID  building
 but would not expect the following to hold:
dept_name  salary
 A functional dependency is trivial if it is satisfied by
all instances of a relation
 Example:
ID, name  ID
name  name
In general, α  β is trivial if β  α
 The most important properties are Armstrong's
axioms, which are used in database normalization:
 Subset Property
If Y is a subset of X, then X → Y
 Augmentation
If X → Y, then XZ → YZ
 Transitivity
If X → Y and Y → Z, then X → Z
 From these rules, we can derive these secondary rules:
 Union:
If X → Y and X → Z, then X → YZ
 Decomposition:
If X → YZ, then X → Y and X → Z
 Pseudotransitivity:
f X → Y and WY → Z, then XW → Z
 We can avoid update anomalies by decomposition of
the original relation.
 The relation scema R is decomposed into relation
schemas:
 {R1,R2,R3,…….,Rn} in such a way that
R1  R2  …  Rn = R
Lending_schema =
(Branch_name, Branch_city, Assets,
Cusomer_name, Loan_number, Amount)
 The Lending schema is decomposed into following two
relations:
1) Branch_customer_schema =
(Branch_name, Branch_city, Assets,
Cusomer_name)
2) Customer_loan_schema =
(Cusomer_name, Loan_number, Amount)
Branch_Name Branch_City Assets Customer_Name
Downtown Brooklyn 90000 Jones
Redwood Palo Alto 21000 Smith
Perryridge Horseneck 90000 Jackson
Mianus Horseneck 80000 Jones
Northtown Rye 37000 Hayes
Customer_Name Loan_No Amount
Jones L-17 10000
Smith L-23 2000
Jackson L-14 1500
Jones L-11 900
Hayes L-16 1300
The Branch_customer Relation
The Customer_loan Relation
Branch_Na
me
Branch_Ci
ty
Assets Customer_
Name
Loan_No Amount
Downtown Brooklyn 90000 Jones L-17 10000
Downtown Brooklyn 90000 Jones L-11 9000
Redwood Palo Alto 21000 Smith L-23 2000
Perryridge Horseneck 90000 Jackson L-14 1500
Mianus Horseneck 80000 Jones L-11 900
Mianus Horseneck 80000 Jones L-17 1000
Northtown Rye 37000 Hayes L-16 1300
The result of this join is shown below:
The relation Branch_customer Customer_loan
1. If the relation Branch_customer and Customer_loan
is compared with the original lending relation, we
observe that:
 Every tuple in lending relation is in Branch_customer
and Customer_loan relation.
 The relation Branch_customer and Customer_loan
contain following additional tuples:
 (Downtown,Brooklyn,90000,Jones,L-11,9000)
 (Mianus,Horseneck,80000,Jones,L-17,1000)
2. Consider the query:
 “Find all the branches that have made a loan in an
amount less than Rs. 1000.”
 The result of this query using the lending relation is :
Mianus.
 The result of the same query using the relation
Branch_customer and Customer_loan is: Downtown
and Mianus.
3. From the above two cases we can say that
the decomposition of lending relation into
Branch_customer and Customer_loan
results in bad database design. It results in
loss of information and repetition of
information.
4. Because of loss of information, we call the
decomposition of lending relation into
Branch_customer and Customer_loan a
lossy decomposition or a lossy-join
decomposition.
 Decomposition help us eliminate redundancy, root of
data anomalies.
 There are two important properties associated with
decomposition:
 1. Lossless join
 2. Dependency Preservation
 This property ensures that any instance of the original relation
can be identifies from the corresponding instances in the smaller
relation.
 Let R be a relational schema, and let F be a set of functional
dependencies on R. Let R1 and R2 form a decomposition of R.
This decomposition is a lossless-join decomposition of R if at
least one of the following functional dependencies is in F+
R1  R2  R1
R1  R2  R2
 In other word, if R1  R2 forms a superkey of either R1 or R2, the
decomposition of R is a lossless-join decomposition.
Question: Let R(A,B,C) and F=(AB).Check the
decomposition of R into R1(A,B) and R2(A,C).
 R1  R2 is A which is comman attribute.
A B is the FD in F. (augmentation rule)
A AB which is relation R1.
Thus,
 R1  R2 is satisfies.
 Hence, above decomposition is lossless-join
decomposition.
Question: Let R(A,B,C) and F=(A B).Check the
decomposition of R into R1(A,B) and R2(B,C).
 R1  R2 is B which is comman attribute.
 But B is not a superkey of either R1 or R2.
 Hence this decomposition is not a lossless-join
decomposition.
 This property ensures that a constraint on the original
relation can be maintained by simply enforcing some
constraint on each of the smaller relation.
 Given a relational schema R and set of fuctional
dependencies associated with it is F.
 R is decomposed into the relation schema R1,R2,…Rn
with functional dependencies F1,F2,…Fn.
 Then the decomposition is dependency preserving
if the closure of F’ (where F’=F1,F2,….Fn) is
identical to F+.
F’+ =F+
 Getting lossless decomposition is necessary.
Question: R=(A, B, C), F={A  B, B  C} Decomposition
of R: R1=(A, C) R2=(B, C) Does this decomposition preserve
the given dependencies?
 In R1 the following dependencies hold:
F1’={A  A, C  C, A  C, AC  AC}
 In R2 the following dependencies hold:
F2’= {B  B, C  C, B  C, BC  BC}
 The set of nontrivial dependencies hold on R1 and R2:
F‘ = {B  C, A  C}
 A  B can not be derived from F’, so this decomposition is
NOT dependency preserving.
Question: R=(A, B, C), F={A  B, B  C}
Decomposition of R: R1=(A, B) R2=(B, C) Does this
decomposition preserve the given dependencies?
 In R1 the following dependencies hold:
F1={A  B, A  A, B  B, AB  AB}
 In R2 the following dependencies hold:
F2= {B  B, C  C, B  C, BC  BC}
 F’= F1’ U F2’ = {A  B, B  C, trivial dependencies}
 In F’ all the original dependencies occur, so this
decomposition preserves dependencies.

More Related Content

What's hot

System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
SARASWATHI S
 
Er model ppt
Er model pptEr model ppt
Er model ppt
Pihu Goel
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
Bansari Shah
 
Parsing
ParsingParsing
Parsing
khush_boo31
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
soniyagoyal3
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
Adarsh Patel
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMSkoolkampus
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
Saranya Natarajan
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mappingsaurabhshertukde
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
VENNILAV6
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
Dattatray Gandhmal
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mappingShubham Saini
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
A. S. M. Shafi
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
Akhil Kaushik
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
Mahbubur Rahman
 
Dbms 7: ER Diagram Design Issue
Dbms 7: ER Diagram Design IssueDbms 7: ER Diagram Design Issue
Dbms 7: ER Diagram Design Issue
Amiya9439793168
 

What's hot (20)

System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
Single pass assembler
Single pass assemblerSingle pass assembler
Single pass assembler
 
Parsing
ParsingParsing
Parsing
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
 
Loaders ( system programming )
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
 
14. Query Optimization in DBMS
14. Query Optimization in DBMS14. Query Optimization in DBMS
14. Query Optimization in DBMS
 
ER-Model-ER Diagram
ER-Model-ER DiagramER-Model-ER Diagram
ER-Model-ER Diagram
 
Er & eer to relational mapping
Er & eer to relational mappingEr & eer to relational mapping
Er & eer to relational mapping
 
STRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIESSTRUCTURE OF SQL QUERIES
STRUCTURE OF SQL QUERIES
 
Input-Buffering
Input-BufferingInput-Buffering
Input-Buffering
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
 
Token, Pattern and Lexeme
Token, Pattern and LexemeToken, Pattern and Lexeme
Token, Pattern and Lexeme
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Dbms 7: ER Diagram Design Issue
Dbms 7: ER Diagram Design IssueDbms 7: ER Diagram Design Issue
Dbms 7: ER Diagram Design Issue
 

Similar to Decomposition using Functional Dependency

Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
Drishti Bhalla
 
ch7-clean.ppt
ch7-clean.pptch7-clean.ppt
ch7-clean.ppt
RAJULKUMARSUTHAR
 
UNIT 2 -PPT.pptx
UNIT 2 -PPT.pptxUNIT 2 -PPT.pptx
UNIT 2 -PPT.pptx
hemamalinikrishnan2
 
Function Dependencies and Normalization
 Function Dependencies and Normalization Function Dependencies and Normalization
Function Dependencies and Normalization
BLDE'S S.S.M.Polytechnic,Vijayapur
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
Normalization
NormalizationNormalization
Normalization
rehanlko007
 
Normalization1
Normalization1Normalization1
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
KalpanaThakre2
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
Ajit Nayak
 
7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependenciesKumar
 
Normalization
NormalizationNormalization
Normalization
Sakshi Jaiswal
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
Roshni Singh
 
Normalization
NormalizationNormalization
Normalization
Dabbal Singh Mahara
 
Database
DatabaseDatabase
Database
Riki Afriansyah
 

Similar to Decomposition using Functional Dependency (20)

L8 design1
L8 design1L8 design1
L8 design1
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
Normalization
NormalizationNormalization
Normalization
 
ch7-clean.ppt
ch7-clean.pptch7-clean.ppt
ch7-clean.ppt
 
UNIT 2 -PPT.pptx
UNIT 2 -PPT.pptxUNIT 2 -PPT.pptx
UNIT 2 -PPT.pptx
 
Function Dependencies and Normalization
 Function Dependencies and Normalization Function Dependencies and Normalization
Function Dependencies and Normalization
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
Normalization
NormalizationNormalization
Normalization
 
ch7
ch7ch7
ch7
 
Normalization1
Normalization1Normalization1
Normalization1
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
L9 design2
L9 design2L9 design2
L9 design2
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies7 relational database design algorithms and further dependencies
7 relational database design algorithms and further dependencies
 
Normalization
NormalizationNormalization
Normalization
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Normalization
NormalizationNormalization
Normalization
 
Database
DatabaseDatabase
Database
 
Ch7
Ch7Ch7
Ch7
 
App C
App CApp C
App C
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 

Decomposition using Functional Dependency

  • 1. Prepared by: RAJ NAIK SY CE-1 150410107053
  • 2.  Fuctional dependencies play a key role in differentiating good database designs from bad database designs.  Let R be a relation schema, α  R and β  R  The functional dependency α  β holds on R if and only if for any legal relations r(R), whenever any two tuples t1 and t2 of R agree on the attributes α, they also agree on the attributes β. That is,  t1 [α] = t2 [α]  t1 [β] = t2 [β ]
  • 3.  Example: Consider r(A,B) with the following instance of r.  On this instance, A  B does NOT hold, but B  A does hold.  A functional dependency is a generalization of the notion of a key 1 4 1 7 4 6
  • 4.  K is a superkey or for relation schema R if and only if K  R  K is a candidate key for R if and only if K  R, and for no α  K, α  R  Functional dependencies allow us to express constraints that cannot be expressed using superkeys.
  • 5. Consider the schema: inst_dept (ID, name, salary, dept_name, building, budget )  We expect these functional dependencies to hold: dept_name  building ID  building  but would not expect the following to hold: dept_name  salary
  • 6.  A functional dependency is trivial if it is satisfied by all instances of a relation  Example: ID, name  ID name  name In general, α  β is trivial if β  α
  • 7.  The most important properties are Armstrong's axioms, which are used in database normalization:  Subset Property If Y is a subset of X, then X → Y  Augmentation If X → Y, then XZ → YZ  Transitivity If X → Y and Y → Z, then X → Z
  • 8.  From these rules, we can derive these secondary rules:  Union: If X → Y and X → Z, then X → YZ  Decomposition: If X → YZ, then X → Y and X → Z  Pseudotransitivity: f X → Y and WY → Z, then XW → Z
  • 9.  We can avoid update anomalies by decomposition of the original relation.  The relation scema R is decomposed into relation schemas:  {R1,R2,R3,…….,Rn} in such a way that R1  R2  …  Rn = R
  • 10. Lending_schema = (Branch_name, Branch_city, Assets, Cusomer_name, Loan_number, Amount)  The Lending schema is decomposed into following two relations: 1) Branch_customer_schema = (Branch_name, Branch_city, Assets, Cusomer_name) 2) Customer_loan_schema = (Cusomer_name, Loan_number, Amount)
  • 11. Branch_Name Branch_City Assets Customer_Name Downtown Brooklyn 90000 Jones Redwood Palo Alto 21000 Smith Perryridge Horseneck 90000 Jackson Mianus Horseneck 80000 Jones Northtown Rye 37000 Hayes Customer_Name Loan_No Amount Jones L-17 10000 Smith L-23 2000 Jackson L-14 1500 Jones L-11 900 Hayes L-16 1300 The Branch_customer Relation The Customer_loan Relation
  • 12. Branch_Na me Branch_Ci ty Assets Customer_ Name Loan_No Amount Downtown Brooklyn 90000 Jones L-17 10000 Downtown Brooklyn 90000 Jones L-11 9000 Redwood Palo Alto 21000 Smith L-23 2000 Perryridge Horseneck 90000 Jackson L-14 1500 Mianus Horseneck 80000 Jones L-11 900 Mianus Horseneck 80000 Jones L-17 1000 Northtown Rye 37000 Hayes L-16 1300 The result of this join is shown below: The relation Branch_customer Customer_loan
  • 13. 1. If the relation Branch_customer and Customer_loan is compared with the original lending relation, we observe that:  Every tuple in lending relation is in Branch_customer and Customer_loan relation.  The relation Branch_customer and Customer_loan contain following additional tuples:  (Downtown,Brooklyn,90000,Jones,L-11,9000)  (Mianus,Horseneck,80000,Jones,L-17,1000)
  • 14. 2. Consider the query:  “Find all the branches that have made a loan in an amount less than Rs. 1000.”  The result of this query using the lending relation is : Mianus.  The result of the same query using the relation Branch_customer and Customer_loan is: Downtown and Mianus.
  • 15. 3. From the above two cases we can say that the decomposition of lending relation into Branch_customer and Customer_loan results in bad database design. It results in loss of information and repetition of information. 4. Because of loss of information, we call the decomposition of lending relation into Branch_customer and Customer_loan a lossy decomposition or a lossy-join decomposition.
  • 16.  Decomposition help us eliminate redundancy, root of data anomalies.  There are two important properties associated with decomposition:  1. Lossless join  2. Dependency Preservation
  • 17.  This property ensures that any instance of the original relation can be identifies from the corresponding instances in the smaller relation.  Let R be a relational schema, and let F be a set of functional dependencies on R. Let R1 and R2 form a decomposition of R. This decomposition is a lossless-join decomposition of R if at least one of the following functional dependencies is in F+ R1  R2  R1 R1  R2  R2  In other word, if R1  R2 forms a superkey of either R1 or R2, the decomposition of R is a lossless-join decomposition.
  • 18. Question: Let R(A,B,C) and F=(AB).Check the decomposition of R into R1(A,B) and R2(A,C).  R1  R2 is A which is comman attribute. A B is the FD in F. (augmentation rule) A AB which is relation R1. Thus,  R1  R2 is satisfies.  Hence, above decomposition is lossless-join decomposition.
  • 19. Question: Let R(A,B,C) and F=(A B).Check the decomposition of R into R1(A,B) and R2(B,C).  R1  R2 is B which is comman attribute.  But B is not a superkey of either R1 or R2.  Hence this decomposition is not a lossless-join decomposition.
  • 20.  This property ensures that a constraint on the original relation can be maintained by simply enforcing some constraint on each of the smaller relation.  Given a relational schema R and set of fuctional dependencies associated with it is F.  R is decomposed into the relation schema R1,R2,…Rn with functional dependencies F1,F2,…Fn.
  • 21.  Then the decomposition is dependency preserving if the closure of F’ (where F’=F1,F2,….Fn) is identical to F+. F’+ =F+  Getting lossless decomposition is necessary.
  • 22. Question: R=(A, B, C), F={A  B, B  C} Decomposition of R: R1=(A, C) R2=(B, C) Does this decomposition preserve the given dependencies?  In R1 the following dependencies hold: F1’={A  A, C  C, A  C, AC  AC}  In R2 the following dependencies hold: F2’= {B  B, C  C, B  C, BC  BC}  The set of nontrivial dependencies hold on R1 and R2: F‘ = {B  C, A  C}  A  B can not be derived from F’, so this decomposition is NOT dependency preserving.
  • 23. Question: R=(A, B, C), F={A  B, B  C} Decomposition of R: R1=(A, B) R2=(B, C) Does this decomposition preserve the given dependencies?  In R1 the following dependencies hold: F1={A  B, A  A, B  B, AB  AB}  In R2 the following dependencies hold: F2= {B  B, C  C, B  C, BC  BC}  F’= F1’ U F2’ = {A  B, B  C, trivial dependencies}  In F’ all the original dependencies occur, so this decomposition preserves dependencies.