R
Russ via AccessMonster.com
What is general opinion on this, should I be saving sales tax data in my
orders table or just calculating it? What are pros and cons?
orders table or just calculating it? What are pros and cons?
Allen said:Russ, one of the basic rules of data normalization is not to store dependent
data. The tax *rate* is independent of the value of the order, but the tax
amount is not. Therefore, storing the rate as Duane suggested is the correct
approach.
You also asked whether the rate should be stored in the order header table
or in the detail table. In some places, there are items that are tax exempt.
In my country, for example, unprocessed food is tax exempt, where as
pre-processed food is taxable. If you thought your database might ever have
to cope with that situation, you would need to store the tax rate in the
detail table. If you are sure that situation will never arise, you could
choose to store the tax rate in the header table.
[quoted text clipped - 15 lines]I would not store both the rate and the amount.
Russ via AccessMonster.com said:Allen,
Would you store the tax rate and taxable in the product table?
example
partnumber1 0.5% (tax rate) yes (taxable?)
partnumber2 0.0% (tax rate) No (taxable?)
Is this the correct way of doing it?
Allen said:Russ, one of the basic rules of data normalization is not to store
dependent
data. The tax *rate* is independent of the value of the order, but the tax
amount is not. Therefore, storing the rate as Duane suggested is the
correct
approach.
You also asked whether the rate should be stored in the order header table
or in the detail table. In some places, there are items that are tax
exempt.
In my country, for example, unprocessed food is tax exempt, where as
pre-processed food is taxable. If you thought your database might ever
have
to cope with that situation, you would need to store the tax rate in the
detail table. If you are sure that situation will never arise, you could
choose to store the tax rate in the header table.
[quoted text clipped - 15 lines]I would not store both the rate and the amount.my
orders table or just calculating it? What are pros and cons?
Russ via AccessMonster.com said:Allen,
Would you store the tax rate and taxable in the product table?
example
partnumber1 0.5% (tax rate) yes (taxable?)
partnumber2 0.0% (tax rate) No (taxable?)
Is this the correct way of doing it?
In most cases I think you would put products in a category, and specify the
tax rate for the category. Thanks..
Allen said:Depends.
You would not store both the tax rate (number, double) and IsTaxable
(yes/no). A tax rate of zero defines not taxable.
In most cases I think you would put products in a category, and specify the
tax rate for the category. If the govt did decide to change the tax rate,
changing every individual product could be a pain, and products of one type
should (by definition) be able to share the same tax rate.
Of course, the price and tax rate you store in the Product table is the
current price and tax rate, so you still need them in your OrderDetail (i.e.
the actual price and tax rate at the time of the sale.)
[quoted text clipped - 26 lines]Allen,