help on table strucure doubt ???

Discussion in 'MCSD' started by Guest, May 17, 2007.

  1. Guest

    Guest Guest

    Dear all,

    I am preapring my last exam to MCSD.NEt (let you guess which none is the
    last) and I use transcender test for that and I am actually face to a
    situation where I do not catch the reason of a particular table
    configuration. If you can help I will apreciate.

    The scenario is as follow :
    It is mention to identify the correct relation fro modeling the fact that
    EACH book maybe writen by more that one author.

    Possible choice was :
    a - Create a Book parent entity and an Author child entity
    b - Create a Book child entity and an Author parent entity
    c - Create a Book and Author parent entities and an BookAuthor child entity
    d - Create a Book and Author child entities and an BookAuthor parent entity

    The correect answer is C and I am not understanding why.
    For me I was selected A

    Do you have any comment to help me catch why C and not A ?

    thanks for your reply
    regards
    serge
     
    Guest, May 17, 2007
    #1
    1. Advertisements

  2. Guest

    Blackmetal Guest

    my 2 cents:

    Think on this:
    Author Table:
    ID,Author
    1, John C
    2, Ann D

    Book table:
    ID,Title
    A,My Book
    B,Their Book

    Then, the BookAuthor:
    Book,Author
    A,1
    B,1
    B,2

    It means that Author cannot be a child table from Book or viceversa because
    the relationship as expressed in the scenario, it is many-to-many and a
    separate table will accomplish this task.

    In my example, the Book A, belongs to John C, and The Book B, belongs to
    John C and Ann D.

    Hope this helps
     
    Blackmetal, May 17, 2007
    #2
    1. Advertisements

  3. Guest

    Egghead Guest

    It is third normalization, and it allows you to have many-to-many
    relationship without duplicates.
    If A is ans, how can you build the model?
     
    Egghead, May 17, 2007
    #3
  4. Guest

    Guest Guest

    Thnaks for you reply...

    But could it be also teh same thing with your 2 first tables by simply
    adding BookID to aujto table and set primnary key to ID, bookID in AUthor
    table ?

    serge
     
    Guest, May 17, 2007
    #4
  5. Guest

    Guest Guest

    can I build the model with A as follow :

    BOOK
    Id,Title, AuthorID ( primary key on ID, AUthorID)

    AUTHOR
    Id,Name,BookId (primary key on Id,BookId)

    serge
     
    Guest, May 17, 2007
    #5
  6. Guest

    Blackmetal Guest

    Well, even though it works, the model does not comply fullest with
    normalization.

    Through my experience (and even here in the company I work) I have found
    some of this models done by some other programmers which I ended up by
    spliting the tables using a CrossReference AKA the many-to-many as the
    propossed model.
     
    Blackmetal, May 17, 2007
    #6
  7. Guest

    Blackmetal Guest

    I forgot to add:

    I've felt really pissed off by this type of programming, because sometimes,
    I had to make a fix to someone else's work...and simply the way the queries
    are built are so messy and so complex without reason that I ended up by
    re-writting the queries or modify the schema of the involved tables.
     
    Blackmetal, May 17, 2007
    #7
  8. Guest

    Blackmetal Guest

    Holy Crap...I'm keep on forgetting things...

    And precisely, in a MS exam this is a very valid point too, because even
    your model worked, according the Exam, it would be a bad score because
    that's not the best solution, and many of us might have failed in questions
    in our exams too, but that's the good thing about learning.
     
    Blackmetal, May 17, 2007
    #8
  9. Your model doesn't allow many-to-many modeling with any real sense of
    correctness. It's horribly denormalized.

    Let's suppose I had book "How to pass 70-300", and it was writen by
    "Author1", "Author2", "Author3".
    Let's also say, "Author1" wrote "How to fail 70-300"

    What values would be in the two tables?

    The closes I can come is:
    ID 1 = "How to pass 70-300"
    ID 2 = "How to fail 70-300"

    ID 3 = "Author1"
    ID 4 = "Author2"
    ID 5 = "Author3"

    Which would give
    [Book]
    1, How to pass 70-300, 3
    1, How to pass 70-300, 4
    1, How to pass 70-300, 5
    2, How to fail 70-300, 3

    [Author]
    3, Author1, 1
    3, Author1, 2
    4, Author2, 1
    5 Author3, 1

    Clearly, this schema isn't the best answer available.
     
    Chris Mullins [MVP], May 17, 2007
    #9
  10. Guest

    Guest Guest

    yes thats for sure I undersatnd your pain in such situation. I guess similar
    situation with programmers who did not follow guide line that I was
    describing and then correct they< work and loosing time...

    But for my case actually I am not an SQL guy, it just come time to time
    during dayly work but I am not a specialist on the way to organise tables and
    so on. And thatt is the reason I was stuck in this situation when learning my
    final exam...And when I do not cacth the idea of doing it in this way and not
    the other, I will stick on it for days...

    Now your answer it clear now for me, the way I was saying works, but it is
    not the normal way of snormalization...

    Thnaks for your reply
    regards
    serge
     
    Guest, May 18, 2007
    #10
  11. Guest

    Guest Guest

    thanks chris...
    I catch it now....I ma not a specialista in SQL admin, just learning
    sometimes...

    regards
    serge

     
    Guest, May 18, 2007
    #11
  12. Guest

    Blackmetal Guest

    You're welcome and that's my daily pain :)


     
    Blackmetal, May 18, 2007
    #12
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.