Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1695

Re: Is it good to have a price column imn OrderLine table

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Is it good to have a price column imn OrderLine table
Date 2014-02-27 08:06 +0000
Organization Erland Sommarskog
Message-ID <XnsA2E15CB6F8EBAYazorman@127.0.0.1> (permalink)
References <lelpn8$8sq$1@dont-email.me>

Show all headers | View raw


Tony Johansson (johansson.andersson@telia.com) writes:
> Now to my question is it good to have a price column in the OrderLine
> table. ? 
> If we have a price will that mean the total price per line such as if we
> have ordered 3 shoes and this specific shoes cost 10 the price field in
> OrderLine would be 30 

All this depends on business rules, but yes, I would expect a price column
in a Orderline table. That gives the price for that specific order. The customer may have gotten a discount. And more importantly, if you change the
price for the product, you don't want that to affect old orders.

Although, in your example I would store 10 in the Price column in the
Orderline table. If it was called Amount I would store 30. But that's more of a language issue.


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Is it good to have a price column imn OrderLine table "Tony Johansson" <johansson.andersson@telia.com> - 2014-02-26 23:26 +0100
  Re: Is it good to have a price column imn OrderLine table Erland Sommarskog <esquel@sommarskog.se> - 2014-02-27 08:06 +0000
    Re: Is it good to have a price column imn OrderLine table rja.carnegie@gmail.com - 2014-02-27 03:22 -0800
      Re: Is it good to have a price column imn OrderLine table Erland Sommarskog <esquel@sommarskog.se> - 2014-02-27 11:50 +0000
  Re: Is it good to have a price column imn OrderLine table Mark D Powell <markp28665@gmail.com> - 2014-02-27 11:23 -0800

csiph-web