Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Start here: <a href="http://support.microsoft.com/kb/283878" rel="nofollow">http://support.microsoft.com/kb/283878</a></p> <p>You never want to store calculations directly in a table, the calculations will be done by the queries that generate your data. Table 3 is actually the results of a simple query.</p> <p>From what you have above, I would say you have at least the following three tables:</p> <p>Customers - contains basic customer data, one row per customer, and some kind of ID that you generate (probably an integer identity column is best, but can be anything you choose).</p> <p>Produce (or Products, if you have more than fruit and vegetables) - one row per product containing product information, some kind of ID that you generate (again, integer identity is the best).</p> <p>Sales - one row per transaction</p> <p>Here's where things get a little tricky. You could have Sales and SalesItems where sales has a unique row for each transaction and SalesItems contains one row for each product that was purchased in the transaction, but for a really simple system as you appear to have above, you could just get away with a Sales table that has ProductID and CustomerID along with quantity and whatever else you want to store.</p> <p>EDIT: It's a safe bet that a simple system will one day grow into a complicated system, so if I were designing the database I would probably go with separate tables for Sales and SalesItems to make the database more flexible and able to scale better.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload