I have a form to generate quotes online. The form has many products with their respective prices and options.
The users will generate the quote online and I need to store the quotes of the users when they submit the form.
My question is how I do a design a database to store this information?
This is an example of my form:
Description amount price x un total
product1 1 15000 15000
product 2 3 10000 30000
Total 45000
I have thought the next options:
id_quote descriptions total
1 product1 1 15000 45000
product2 3 45000
Other option is by date:
id date description amount price total
1 15/03/2012 3_45:45 product 1 1 15000 45000
2 15/03/2012 3_45:45 product 2 3 10000 30000
Best Answer
Your second option is better, though I'm confused: is that a Quotes table? If so, are those two records the same quote or different quotes? Also, there's no need to store
total
, you can calculate that when you need it. I'd generally say that calculated values should only be stored if the calculations are very complex and long-running.Here's a simple table structure for the quotes that might help get you started: