Book Image

Creating your MySQL Database: Practical Design Tips and Techniques

By : Marc Delisle
Book Image

Creating your MySQL Database: Practical Design Tips and Techniques

By: Marc Delisle

Overview of this book

For most of us, setting up the database for an application is often an afterthought. While you don't need to be a professional database designer to create a working application, knowing a few insider tips and techniques can make both the process easier and the end result much more effective. This book doesn't set out to make you an expert in data analysis, but it does provide a quick and easy way to raise your game in this essential part of getting your application right.
Table of Contents (12 chapters)

Data that are Results


Even though it might seem natural to have a distinct element for the total_price of the car, in practice this is not justified. The reason is that the total price is a computed result. Having the total price printed on a sales contract constitutes an output. Thus, we eliminate this information in the list of column names. For the same reason, we could omit the tax column because it can be computed.

By removing the total price column, we could encounter a pitfall. We have to be sure that we can reconstruct this total price from other sub-total elements, now and in the future. This might not be possible for a number of reasons:

  • The total price includes an amount located in another table, and this table will change over time (for example, the tax rate). To avoid this problem, see the recommendations in the Scalability over Time section in Chapter 4.

  • This total price contains an arbitrary value, due to some exceptional cases, for example, where there is a special sale, and...