Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Wrox Announcements and Feedback > Wrox Book Feedback
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 2nd, 2004, 12:08 PM
Authorized User
 
Join Date: Jun 2004
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
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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
 
Join Date: Jun 2003
Posts: 1,101
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
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





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 11:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.