The Student Room Group

Not sure about coursework

OK my AS ICT coursework is on a shop and I'm doing invoicing.

My teacher told me to make a customer table and a products table but the last two have confused me. The teacher said a sales and order table with the fields Order ID, date, customer id, amount due. then the sales table will have order id, product id and quantity but I don't understand the point in the two tables and don't have a clue what I'm supposed to do.

The only thing I can think he means is when someone buys something it's put in to the orders table and then the amount due is updated then once they have fully paid it's deleted and put in the order table.

Any ideas to explain this or for a better structure would be appreciated thanks.
Reply 1
Err um err...
It's all about resolving the many-to-many relationship between customers and products. Because an order can be made up of many products you can't store the details in a single table without lots of redundancy (duplication) hence the second table to record the *details* of the order. Thinking about what an invoice actually looks like might help understand your teacher's reasoning: the top bit contains the order#, date, customer details (this is your order table) and the bottom bit contains details about the products, quantities bought as part of that order (this is your sales table - I'd have called it orders_products).

There's an example on here
http://www.thekjs.essex.sch.uk/yates/candy_floss.htm
called transaction if you need more help.

HTH
FatMax
www.fatmax.org
BTW Storing the amount due in a table is a baaaaaaaad idea. Discuss.
Reply 2
So basically for the order table you put a customers order in it but because it can be many items you list all the items and quantities bought as part of that one order in the sales table. Thank you if that's right, you're better than my teacher it seems.

So if it's bad to keep amount due in a table what am I supposed to do about that then?
The amount due should technically appear on the report printout...no idea where it should be kept until then :s-smilie:
Try www.thekjs.essex.sch.uk and see if you can find any advice on there. If not...try asking your teacher or friends or whatever...other people are probably just as confused :confused:

Latest

Trending

Trending