Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Question on Canidate keys and functional dependecies

Question on Canidate keys and functional dependecies

Scheduled Pinned Locked Moved Database
comquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10830975
    wrote on last edited by
    #1

    Ok :sigh: this is probably going to be the easiest answer you guys have ever given bit i am finding this concept difficult i guess it just isnt clicking http://prntscr.com/3ps60e[^] ^picture of the table i have a question about i am trying to fine the canidate key and the functional dependency in this table :/ i understand what a functional dependency is but cant figure out how it relates to this table for instance CookieCost = NumberOfBoxes X $5 i know that cookie cost is functiolly dependent on the number of boxes but yea i suppose if you could tell me the answer but more importantly HOW you got that i would REALLY appreciate it

    L 2 Replies Last reply
    0
    • U User 10830975

      Ok :sigh: this is probably going to be the easiest answer you guys have ever given bit i am finding this concept difficult i guess it just isnt clicking http://prntscr.com/3ps60e[^] ^picture of the table i have a question about i am trying to fine the canidate key and the functional dependency in this table :/ i understand what a functional dependency is but cant figure out how it relates to this table for instance CookieCost = NumberOfBoxes X $5 i know that cookie cost is functiolly dependent on the number of boxes but yea i suppose if you could tell me the answer but more importantly HOW you got that i would REALLY appreciate it

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 10865129 wrote:

      i know that cookie cost is functiolly dependent on the number of boxes

      That goes for all calculations, but that's not what's meant in the context of normalization.

      Member 10865129 wrote:

      i am trying to fine the canidate key and the functional dependency in this table

      The table should be in 0NF first, in which case it needs a name. To find the candidate keys, you'd make a list of the fields that can be used to identify a unique record. They look like meetings. What fields would the you combine to get a unique meeting - no, rephrase, which of those facts does the user require to uniquely identify an entry? If I'm not mistaken, then it's a compound key. Next you'll be hunting for fields that are functionally dependent on a part of that key; they need to be moved to their own table (if there are any, and yes, I seen one) Ask yourself for each non-key field the question: "does this fact depend on the complete cadidate key, or is it determined by part of the candidate?" Easy explanation; http://support.microsoft.com/kb/283878[^] Complex explanation; http://en.wikipedia.org/wiki/Functional_dependency[^]

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      1 Reply Last reply
      0
      • U User 10830975

        Ok :sigh: this is probably going to be the easiest answer you guys have ever given bit i am finding this concept difficult i guess it just isnt clicking http://prntscr.com/3ps60e[^] ^picture of the table i have a question about i am trying to fine the canidate key and the functional dependency in this table :/ i understand what a functional dependency is but cant figure out how it relates to this table for instance CookieCost = NumberOfBoxes X $5 i know that cookie cost is functiolly dependent on the number of boxes but yea i suppose if you could tell me the answer but more importantly HOW you got that i would REALLY appreciate it

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Member 10865129 wrote:

        more importantly HOW you got

        0 NF:

        Attorney

        ClientNumber

        ClientName

        MeetingData

        Duration

        Boxer

        1000

        ABC, Inc

        11/5/13

        2

        Boxer

        2000

        XYZ Partners

        11/5/13

        5.50

        James

        1000

        ABC, Inc

        11/7/13

        3

        Boxer

        1000

        ABC, Inc

        11/9/13

        4

        Wu

        3000

        Malcomb Zoe

        11/11/13

        7

        1 NF: * Remove all calculated facts * Assign a key * Move repeating groups to their own table (key is underlined)

        Attorney

        ClientNumber

        MeetingData

        Duration

        Boxer

        1000

        11/5/13

        2

        Boxer

        2000

        11/5/13

        5.50

        James

        1000

        11/7/13

        3

        Boxer

        1000

        11/9/13

        4

        Wu

        3000

        11/11/13

        7

        ClientNumber

        ClientName

        1000

        ABC, Inc

        2000

        XYZ Partners

        3000

        Malcomb Zoe

        2 NF: * Find the attributes that are not "functionally dependent" on the entire key That means that we look at each non-key field and ask ourselves whether or not it is depending on the entire key, or whether it can be identified with a part of that key. The only non-key field in "Meetings" is called "Duration". The duration "2" belongs to the meeting that's identified with all three fields, so there's no functional dependency there. In the original table the duration could depend on a part of the key; my mistake. 3NF: * Find non-key fields that depend on other non-key fields. There's none. One might argue that the Attorney is also a repeating group, and put it in it's own table with an artificial key.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups