title: database layout storing price packages
body: <p>I'm working on an application and looking for a database schema to store product sales in a efficient manner relating to the prices. So I'm looking for a database schema and an example query to calculate the price for that month</p>
  
  <p>background info:</p>
  
  <ul>
  <li>the product price is based on the amount of sales for that month</li>
  <li>An identical product can have different prices (depending on price negotiation per company)</li>
  <li>need to be able to change prices without affecting earlier sales/invoices</li>
  <li>store prices without VAT, VAT can change</li>
  </ul>
  
  <p>What I have got so far looks something like this:</p>
  
  <p><em><strong>sales</em></strong></p>
  
  <pre><code>sale_id --PK (auto_incr)
  company_id
  product_type --FK on products.product_type
  sale_date
  </code></pre>
  
  <p><em><strong>products</em></strong></p>
  
  <pre><code>product_id --PK (auto_incr)
  company_id (company_id &amp; product_type = Unique_key)
  product_type
  </code></pre>
  
  <p>*<strong>price_packages*</strong></p>
  
  <pre><code>product_id --FK on products.product_id
  sales_min (total sales need to be between sales_min and sales_max)
  sales_max
  price
  valid_from
  valid_until
  vat_id --FK on vat.vat_id
  </code></pre>
  
  <p><em><strong>vat</em></strong></p>
  
  <pre><code>vat_id --PK (auto_incr)
  vat_percentage
  valid_from
  valid_until
  </code></pre>
  
  <p>I think that there is something wrong with the "sales_max" and "sales_min" columns. Also I'm doubting if this is the best way to store things. Some Advise is welcome. (if possible with an example query)</p>
  
  <p>How would you enter new prices without affecting previous prices.</p>