Page 1 of 2 12 LastLast
Results 1 to 15 of 26

Thread: 2nf

  1. #1
    Join Date
    Mar 2007
    Posts
    45

    2nf

    I am trying to understand 2NF, Is there any way to put the data below in
    2NF:

    http://www.mylabserver.com/226_1/arn...5_1dataImg.gif



    Thank you

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Are you sure you don't mean you have an assignment to get that to 2 NF?

    What have you got so far? And what do you understand to be 2NF?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by robasc
    I am trying to understand 2NF, Is there any way to put the data below in
    2NF:
    probably the first thing you should do is put that data into 1NF

    only after it's in 1NF, then you can start thinking about 2NF
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Aw.... you spoiled my next post
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2007
    Posts
    45
    I do understand 1NF, and I see that project and time has produced repeating groups and therefore violates 1NF.

    But I do not see how to put this in second normal form:

    I do know that emp_id is good enough to determine name and time

    emp_id => name, time

    but what would project determine or can project be by itself?

    I am not really shure I understand 2NF yet?

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    if you understand 1NF, could we see your 1NF design please?

    yes, project can be by itself, just like employee can be by itself
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  7. #7
    Join Date
    Mar 2007
    Posts
    45
    Here is 1NF:
    Code:
    EMP_ID    NAME               PROJ_NUM    TIME
    
    ENI-26    SEAN O' BRIAN      30-452-T3    .25
    ENI-26    SEAN O' BRIAN      30-457-T3    .40
    ENI-26    SEAN O' BRIAN      32-244-T3    .30
    ENI-33    AMY GUYE           30-452-T3    .05
    ENI-33    AMY GUYE           30-382-TC    .35
    ENI-33    AMY GUYE           32-244-T3    .60
    ENI-35    STEVE BARANCO      30-452-T3    .15
    ENI-35    STEVE BARANCO      31-238-TC    .80
    ENI-36    ELIZABETH ROSLYN   35-152-TC    .90
    ENI-38    CAROL SHAAF        36-272-TC    .75
    ENI-40    ALEX WING          31-238-TC    .20
    ENI-40    ALEX WING          31-241-TC    .70
    Last edited by r937; 03-19-07 at 08:47.

  8. #8
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    excellent

    i hope you don't mind, i edited your post to format the display

    okay, now, let's think about what 2NF would mean for this table

    first of all, what would the PK for this table be?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  9. #9
    Join Date
    Mar 2007
    Posts
    45
    Thanks for editing the code,

    the primary key's would be EMP_ID and PROJECT since project seems to uniquely identify each one.

    is this correct?

  10. #10
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, EMP_ID and PROJ_NUM would be a candidate key

    another would be NAME and PROJ_NUM

    another would be EMP_ID and NAME and PROJ_NUM

    what is the definition of 2NF?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  11. #11
    Join Date
    Mar 2007
    Posts
    45
    2NF states that it must be in 1NF and no partial dependencies

  12. #12
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    okay, good

    could you please explain what a partial dependency is -- try to use your last table as the example
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  13. #13
    Join Date
    Mar 2007
    Posts
    45
    it's a dependency that is partially dependent on the primary key
    Last edited by robasc; 03-20-07 at 00:58.

  14. #14
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    good

    so, which are the partial dependencies in that latest table?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  15. #15
    Join Date
    Mar 2007
    Posts
    45
    the partial dependencies are name and time

Posting Permissions

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