You can design this in several different ways, depending on the complexity of your underlying problem. The simplest schema that meets the criteria you described is to put the cost column in the customer table. You can then compute the cost of an order by fetching the price from the customer row and multiplying by the quantity.
As an observation, this design is very simple minded. It doesn't support his tory, it doesn't support customer classes, and it just meets the requirements in your original question. If you have additional constraints, please post a message in the SearchDatabase forums to allow for some dialog about what else you need for your solution.
For More Information
- What do you think about this answer? E-mail the editors at editor@searchDatabase.com with your feedback.
- The Best Database Design Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your database design -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
This was first published in May 2002