If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > What is the difference between a functional dependency and a multivalued dependency?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-07, 23:19
austin2359 austin2359 is offline
Registered User
 
Join Date: Oct 2007
Posts: 2
What is the difference between a functional dependency and a multivalued dependency?

I am reading both definitions, but it's hard to differentiate. It appears a functional dependency is when one value is based on a similar concept as another value, and if you know one, you probably also know the other. I don't get how this is different from a multivalued dependency, which seems to have a similar definition.

Can someone point out to me where the two definitions contrast each other?

Last edited by austin2359; 10-02-07 at 23:26.
Reply With Quote
  #2 (permalink)  
Old 10-03-07, 06:25
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
functional dependency: Given a relation R, a set of attributes X in R is said to functionally determine another attribute Y, also in R, (written X → Y) iff each X value is associated with precisely one Y value.

in other words, Y is dependent on X

in practical terms: give me a value of X, and i can tell you the value of Y that corresponds to it
Code:
SELECT Y FROM daTable WHERE X = 42
functional dependency plays an important part in determining whether a table is in 2NF

so far so good?

multivalued dependency is trickier and comes into play only for 4NF

the wikipedia Course/Book/Lecturer example is actually pretty good, if you can see past the greek script
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 10-03-07, 22:55
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
I have also wondered the same thing Rudy. Take your quote here:

Quote:
Originally Posted by r937
in practical terms: give me a value of X, and i can tell you the value of Y that corresponds to it
Keeping that in mind, when I am personally trying to find a FD I have a problem because "to what degree" do you go to answer that question.

For example, if I have a table with the following attributes

vin
license_Plate


If I ask myself "if I know the value of the license plate, can I get the vin?" I see two possibilities for the answer.

1. The answer should be yes because the vin is associated with that plate in the department of motor vehicle database and using that external source, one could easily find out the info.

2. The answer should be no because without the dmv database one would not know what matches what.

So, to what degree or how far can a person go in answering that question? Are external sources taken into consideration as in my example?

Sorry if I am not clear but it is a little confusing and open to interpretation.

Thanks
Reply With Quote
  #4 (permalink)  
Old 10-04-07, 06:33
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
try not to extend the rule to the general world, but instead, apply it only to the data in the table

foo bar
103 asdf
105 qwer
106 fghj
103 sdfg
105 ghjk

now ask yourself: given a value of foo, can you tell me the corresponding value of bar? if the answer is yes, then bar is functionally dependent on foo
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 10-04-07, 06:58
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Thanks, that clears it up for me. That will come in very handy.

In one of my tables dealing with vehicles, I have seperated the vin thinking that there may have been a FD between the vin and plate.

If one is in doubt, would it be better to seperate the field from the table (to err on the side of caution) or would that be foolhardy? Sometimes, it is not really clear as to what may be a FD or not.
Reply With Quote
  #6 (permalink)  
Old 10-04-07, 07:04
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
i'm sorry, i don't understand "separate the field from the table"
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #7 (permalink)  
Old 10-04-07, 07:14
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Well, when there is a FD, the way to solve it is by removing the determinate.

So for X -> Y you would remove X to remove the FD. Correct? That was what I meant by seperate the field.
Reply With Quote
  #8 (permalink)  
Old 10-04-07, 07:16
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
sorry, frank, i have no idea what you're on about

typically FDs are discussed in terms of candidate keys

why would you want to remove the key?

can you give example data, the way i did in post #4?

oh, and you don't "solve" functional dependencies, you *want* functional dependencies when you're modelling
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #9 (permalink)  
Old 10-04-07, 07:39
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Rudy, I think I may possibly have my terminlogy mixed up. I think I may be talking about a transitive dependancies. The way that I understand 3NF, all of the transitive dependancies have to be removed from my table in order to achive 3NF.

Is it possible that I am confusing the terms? The reason I think I am confusing these two terms is after you said that you want FD in a table, it made me think of 2NF where everything must be dependant on the whole key, and that is a good thing.

Am I incorrect?
Reply With Quote
  #10 (permalink)  
Old 10-04-07, 07:43
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
no you aren't


if you look back at post #2, i did mention that FD plays a role in 2NF

each column must be functionally dependent on the entire key
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #11 (permalink)  
Old 10-04-07, 07:52
Frunkie Frunkie is offline
Gives Bad Advice
 
Join Date: Mar 2007
Location: 010101010110100
Posts: 791
Ok. cool. In post #3, I was actually talking about finding a transitive dependancy. Rudy, would you please tell me if what I am asking in #3 still applies? Would I still exclude outside sources when trying to resolve a TD?
Reply With Quote
  #12 (permalink)  
Old 10-04-07, 12:31
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
gotta be honest, i didn't understand that vin/plate stuff in post #3, but generally speaking, you would do modelling based not on what data is available in the external world, but on the data in your application
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On