Your SlideShare is downloading. ×
0
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Multivalued dependency
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Multivalued dependency

8,449

Published on

Published in: Business, Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
8,449
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
93
Comments
1
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Multivalued Dependency Tamer Abuelata
  • 2. Introduction <ul><li>Goal in Databases: </li></ul><ul><ul><li>BCNF (Boyce Codd Normal Form) </li></ul></ul><ul><ul><li>Losslessness </li></ul></ul><ul><ul><li>Dependency preservation </li></ul></ul>
  • 3. Remember… <ul><li>Boyce Codd Normal Form (BCNF) eliminates all redundancy that can be discovered based on functional dependencies. </li></ul>
  • 4. Issue <ul><li>Some relation schemas, even though they are in BCNF, do not seem to be sufficiently normalized. </li></ul><ul><li>They still contain repetitions </li></ul>
  • 5. Case study <ul><li>Consider the bank database schema: </li></ul><ul><li>cust_loan = ( loan_number, cust_id , cust_name, cust_street, cust_city) </li></ul><ul><li>This is BCNF because of the functional dependency: </li></ul><ul><li>cust_id -> cust_name, cust_street cust_city </li></ul><ul><li>And because cust_id is not a key for cust_loan </li></ul>
  • 6. Case Study <ul><li>But what if some customers have several addresses? </li></ul><ul><li>We no longer wish to enforce the func. dependency: cust_id ->cust_street cust_city </li></ul><ul><li>But we still want to enforce </li></ul><ul><li>cust_id -> cust_name </li></ul>
  • 7. Case Study <ul><li>Following BCNF decomposition algorithm </li></ul><ul><li>we get: </li></ul><ul><li>R1 = ( cust_id , cust_name) </li></ul><ul><li>R2 = ( loan_number, cust_id , cust_street, cust_city) </li></ul><ul><li>(both in BCNF) </li></ul>
  • 8. Case Study <ul><li>The issue </li></ul><ul><li>Despite R2 in BCNF, there is redundancy. We repeat the address of each residence for each loan that the customer has. </li></ul>
  • 9. Case Study <ul><li>We can therefore decompose further into: </li></ul><ul><li>loan_cust_id = (loan_number, cust_id) </li></ul><ul><li>cust_residence = (cust_id, cust_street, cust_city) </li></ul><ul><li>But there is no constraint that lead us to do that. </li></ul><ul><li>To deal with this, we need a few form of constraint: 4NF. </li></ul>
  • 10. 4NF <ul><li>We can use multivalued dependencies to define the fourth normal form </li></ul>
  • 11. 4NF <ul><li>A relation schema R is in fourth normal form with respect to a set D of functional and multivalued dependencies if, for all multivlued dependencies in D+ of the form A -->-> B at least one of the following holds: </li></ul><ul><ul><li>A -->-> B is a trivial multivalued dependency </li></ul></ul><ul><ul><li>A is a superkey for schema R </li></ul></ul>
  • 12. Multivalued Dependency <ul><li>Requires that other tuples of a certain form be present in the relation. </li></ul><ul><li>Multivalued Dependencies </li></ul><ul><li>The  multivalued dependency  relates to this problem when more than one multivalued attributes exist. </li></ul><ul><li>Also referred to as: </li></ul><ul><li>tuple-generating dependency </li></ul>
  • 13. Example <ul><li>R relation schema, A and B follow the multivalued dependency : </li></ul><ul><li>A -->-> B </li></ul><ul><li>The relationship between A and B is independent of the relation between A and R – B </li></ul><ul><li>If A -->-> B is satisfied by all relations on R then </li></ul><ul><li> A -->-> B is a trivial multivalued dependency </li></ul>
  • 14. Example <ul><li>Let’s reconsider </li></ul><ul><li>R2 = ( loan_number, cust_id , cust_street, cust_city) </li></ul>loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-23 99-123 Main Manchester L-93 15-106 Lake Horseneck
  • 15. Example We must repeat the loan number once for each address a customer has and we must repeat the address for each loan a customer has. loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-23 99-123 Main Manchester L-93 15-106 Lake Horseneck
  • 16. Example We must repeat the loan number once for each address a customer has and we must repeat the address for each loan a customer has. This repetition is unnecessary since the relationship between a customer and his address is independent of the relationship between that customer and a loan. loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-23 99-123 Main Manchester L-93 15-106 Lake Horseneck
  • 17. Example <ul><li>Therefore this relation is illegal </li></ul>loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-27 99-123 Main Manchester
  • 18. Example <ul><li>Therefore this relation is illegal </li></ul><ul><li>To make it legal we should add tuples </li></ul><ul><li>(L23, 99-123, Main, Manchester) and </li></ul><ul><li>(L27, 99-123, North, Rye) </li></ul>loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-27 99-123 Main Manchester
  • 19. Example <ul><li>Updated table (legal) </li></ul>loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-27 99-123 Main Manchester L-23 99-123 Main Manchester L-27 99-123 North Rye
  • 20. Example <ul><li>Updated table (legal) </li></ul><ul><li>We want Cust_id -->-> cust_street cust_city </li></ul><ul><li>to hold </li></ul>loan_number cust_id cust_street cust_city L-23 99-123 North Rye L-27 99-123 Main Manchester L-23 99-123 Main Manchester L-27 99-123 North Rye
  • 21. Conclusion <ul><li>We can use multivalued dependencies </li></ul><ul><li>To test relations to determine whether they are legal under a given set of functional and multivalued dependencies </li></ul><ul><li>To specify constraints on the set of legal relations </li></ul>

×