Results 1 to 12 of 12
  1. #1
    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-03-07 at 00:26.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    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

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    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.

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i'm sorry, i don't understand "separate the field from the table"
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    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.

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    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?

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  11. #11
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    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?

  12. #12
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •