+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: 2nd or 3rd normal form

  1. #1
    Barn Enthusiast peebman2000 is on a distinguished road peebman2000's Avatar
    Join Date
    Mar 2008
    Posts
    215
    Rep Power
    4

    2nd or 3rd normal form

    Hey everyone its peeb, hope all is well with everyone. You guys have been in the IT industry or programming industry longer than I have. I've been programming now for a little over 2 years, started as a college intern and then got hired on to my current job. I've build some pretty nice .net apps since I've been here and i'm still learning.

    I'm in the process of building a huge .net application and i'm bumping heads for the first time with my boss on how I should build the database. He wants me to build it in 3rd normal form; he feels all application should be build this way no matter what, etc. I feel with this app, it's more efficient working with the application build in 2nd normal form. That way the selects, the updates and delete queries won't be so complicate to write.

    I've tried to research online to find stuff to show that 3rd normal form is not always the best way to build database for an application. I feel it depends on the type of application you are building.

    Now I may be wrong, my boss has been in the industry longer than I have.

    Below are the database model for the app, 3rd form and 2nd form. I would like you guys suggestions, should I build it my way in 2nd form for more efficient update, selects, and delete queries, or do it the 3rd normal form per what is recognized as the right way to build a database.

    (I saw AOG13 posting, i'm just looking for a suggestion)


    My bosses way 3rd normal form
    http://users3.nofeehost.com/peebman/...dba3rdform.jpg

    My way 2nd normal form
    http://users3.nofeehost.com/peebman/...dba2ndform.jpg

    Again i'm still learning, so if i'm like totally wrong and way in left field, let me know.

    Thanks

    Peeb

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I would stick with 3rd form.

    In 2nd form, it looks like you are creating a new table for each question and hold the answers there. This is not a good idea, IMO, and I think the others will agree with me.

    The 3rd form is setup the way a relational database should be and I find that it's very efficient. You can create a View in SQL Server to denormalize the data, if you need to and you can easily and efficiently use joins to retrieve any related data for a record.

    Just my $0.02...
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Barn Enthusiast peebman2000 is on a distinguished road peebman2000's Avatar
    Join Date
    Mar 2008
    Posts
    215
    Rep Power
    4

    Thanks for the reply Jmurrayhead, I trust your feedback; you've helped me alot in the past.

    Okay i'll go with the 3rd normal form than, I don't know for some reason creating that extra answer table for each question to me seem better for querying and coding wise when coding the app.

    My boss tells me once I fully understand 3rd normal form I'll see its better building the database this way and it will make your application more efficient.

    Thanks for the reply, you may see another posting from me from time to time. This is a five month project.
    Last edited by peebman2000; September 19th, 2008 at 12:20 PM. Reason: edit

  4. #4
    Lightning Master AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123 is a jewel in the rough AOG123's Avatar
    Join Date
    Mar 2008
    Location
    Fortress Of Solitude
    Posts
    394
    Rep Power
    7

    3rd normal form imo as the most logical aproach.

    Although you may find benifits from 2nd normal form in preventing dupicate resonces per user ID on questions,. but that wouldn't be very efficient if you had 100 questions

    that said,. there always more than one way to skin a cat.
    If i helped you, make me famous by clicking the

  5. #5
    Barn Enthusiast peebman2000 is on a distinguished road peebman2000's Avatar
    Join Date
    Mar 2008
    Posts
    215
    Rep Power
    4

    reply

    Thanks, I have 35 questions, i'm building a small practice db now in 3rd form to get a feel for how i'm going to code it with the db built this way.

    Quote Originally Posted by AOG123 View Post
    3rd normal form imo as the most logical aproach.

    Although you may find benifits from 2nd normal form in preventing dupicate resonces per user ID on questions,. but that wouldn't be very efficient if you had 100 questions

    that said,. there always more than one way to skin a cat.

  6. #6
    Moderator don94403 is a jewel in the rough don94403 is a jewel in the rough don94403 is a jewel in the rough don94403's Avatar
    Join Date
    Mar 2008
    Location
    San Mateo, CA, USA
    Posts
    313
    Blog Entries
    8
    Real Name
    Don Ravey
    Rep Power
    6

    Your boss is right. The "normal forms" (up to 5th!) are the foundation of relational database design. There certainly ARE specific situations in which you can gain performance with really large (gigabyte size) databases by "denormalizing", but these cases are best analyzed by a VERY experienced database developer who understands the trade-offs in detail.

    All this "normal form" stuff comes from the fact that relational database theory was developed by Dr. E. F. Codd, a mathematician at IBM in the 1960's. These "forms" are a set of rules that insure that your data will be compatible with the rules that underlie how SQL instructs a database engine to process records. Virtually every relational database software in the world relies on these rules. It is not a matter of preference, it is a matter of following rules that guarantee that your SQL will always work. Sometimes beginners try to "outsmart" the rules, and sometimes they get away with it--for a specific application. But it's like playing russian roulette. Keep doing it and someday your luck will run out.

    Don't you just hate it when the boss is right?!

  7. #7
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Hey, you're lucky. I've got a boss that insists that 0 normal form is the most efficient way. (Go to the board and write "Excel is not a database" 100 times).

    Don's right. Generally you should strive for 3rd normal form and then make any decisions about denormalization only after analysis. There are reasons to denormalize back to 2nd normal form, but you will find you can answer most questions that come up (by writing a query) much easier when the DB is normalized.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  8. #8
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Peeb, not sure where you are at with this survey application, but check out this link: ASP.NET: ASP.NET 2.0 Instant Results - Book Information and Code Download - Wrox

    Search for "Wrox Survey Engine".

    If you can follow this type of model and modify it to your needs, you should have a pretty kickin' survey system.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #9
    Barn Enthusiast peebman2000 is on a distinguished road peebman2000's Avatar
    Join Date
    Mar 2008
    Posts
    215
    Rep Power
    4

    reply

    Okay cool i'll take a look at it. Thanks.

    Quote Originally Posted by jmurrayhead View Post
    Peeb, not sure where you are at with this survey application, but check out this link: ASP.NET: ASP.NET 2.0 Instant Results - Book Information and Code Download - Wrox

    Search for "Wrox Survey Engine".

    If you can follow this type of model and modify it to your needs, you should have a pretty kickin' survey system.

  10. #10
    Barn Enthusiast peebman2000 is on a distinguished road peebman2000's Avatar
    Join Date
    Mar 2008
    Posts
    215
    Rep Power
    4

    reply

    Hey jmurrayhead on the wrox survey engine, how easy do you think it would be for editing?

    One thing with this survery is that the client wants users to be able to edit their answers. I was practicing with using a datalist control, but how the db is set up in 3rd form its hard to pin point what answer is being updated, because of the multiple answer id's. You know what i'm saying or am I sounding crazy.

    But this is probably the main part that I'm a little afraid of, but I'll have to tackle it.



    Quote Originally Posted by peebman2000 View Post
    Okay cool i'll take a look at it. Thanks.

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Bookmarks

Posting Permissions

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

SEO by vBSEO