Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > Wrox Book Feedback
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Wrox Book Feedback A forum to submit feedback on Wrox books if other forums on P2P have been unable to address your book-specific needs. IF YOU ARE LOOKING FOR CODE DO NOT ASK "Where can I find the code for this book?" That question is answered here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Wrox Book Feedback section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 2nd, 2004, 12:08 PM
Authorized User
 
Join Date: Jun 2004
Location: , , USA.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Professional SQL Server 2000 Programming

There is an error on chapter 8 pg.228-229 of "Professional SQL Server 2000 Programming". The Third Normal Form explicitly states that no column can have any dependency on any other non-key column. Yet, the author chose to leave UnitPrice in the OrderDetails Table. UnitPrice obviously depends on PartNo, and should be located in the PartNo Table. What do you guys think?



__________________
Julio Cesar

-\"Bueller.......... Bueller.......... Bueller.......... Bueller..........\"
Reply With Quote
  #2 (permalink)  
Old June 2nd, 2004, 12:31 PM
Imar's Avatar
Wrox Author
Points: 65,708, Level: 100
Points: 65,708, Level: 100 Points: 65,708, Level: 100 Points: 65,708, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 15,973
Thanks: 64
Thanked 1,350 Times in 1,330 Posts
Default

I don't have the book, and I don't know the scenario or requirements that resulted in the final design, but IMO a UnitPrice may be better of in an OrderDetails table than in a PartNo.

When you buy an item, it has a specific price at that very moment. It's that price that you want to maintain in your system for ever for that specific order and product, so it's added to the OrderDetails table rather than to the PartNo table.

Suppose you buy 10 items of product x for $1. After a while, the price is increased to $1,10. Now, looking at the history of the system, did you all of a sudden pay $11.00 for your 10 products? No, you didn't. You still paid $10.
If you'd maintained the price in the PartNo table, the price would also have changed for every historical order, something that you really really don't want in your system.

Does this make sense?

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old June 2nd, 2004, 12:57 PM
Friend of Wrox
Points: 3,489, Level: 24
Points: 3,489, Level: 24 Points: 3,489, Level: 24 Points: 3,489, Level: 24
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Central, NJ, USA.
Posts: 1,102
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I agree with Imar.

I would argue that the price is dependent on the Order - rather than the part number. From the POV of the order price- the price depends on the order itself. As a second order at another time could have another price.

I guess this could also be done by normalizing out the prices and create a pricing table that is effective dated and related to the part.

The second way is probably "more proper".. but I think you can over-normalize things aso. And based on the requirements for the system, there might not be value in normalizing out the pricing.

At least, that's my opinion.



Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
Reply With Quote
  #4 (permalink)  
Old June 2nd, 2004, 01:46 PM
Authorized User
 
Join Date: Jun 2004
Location: , , USA.
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks guys. You both make extremely good points. My initial assumption is definitely not useful for maintaining an Order history. :D My conclusion is that the UnitPrice is dependent on two variables: PartNo and time. Hal's second approach would probably attack that issue best, because otherwise you'd have to always have a hardcopy of recent prices around. I guess it's a trade off between how much of the data you are willing to utilize in hardcopy format vs. database format.

Thanks Again! Hope to have future discussions.

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Book: Professional SQL Server 2005 CLR Programming VictorVictor SQL Server 2005 0 April 7th, 2008 04:47 PM
Exam 70–229 and SQL Server 2000 Programming davesol SQL Server 2000 2 April 19th, 2005 03:45 AM
The code of professional java server programming.. wonderlandshine Wrox Book Feedback 7 September 24th, 2004 06:40 PM
Professional Outlook 2000 Programming Colinspurs Wrox Book Feedback 3 August 17th, 2004 10:32 AM
PROFESSIONAL Commerce Server 2000 Programming nicopadu All Other Wrox Books 1 December 30th, 2003 10:13 AM



All times are GMT -4. The time now is 04:58 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.