Flat-File Design

  Previous section   Next section

This type of design (sometimes known as the "throw-everything-into-one-big-table" design) has been in existence for many years and is common in databases that have been designed for implementation in nonrelational database-management systems. A flat-file design is fraught with problems, as you can see by examining the structure in Figure 14.1.

Figure 14.1. An example of a flat-file structure.

graphics/14fig01.gif

This diagram represents the structure of a single table. (Imagine how other tables within the database are structured!) You can readily see that this structure will inevitably cause problems with redundant data and inconsistent data and that it suffers from a lack of data integrity. As you've probably already noted, there are a few other problems with this structure:

  • Multipart fields. SALES REP NAME includes the sales rep's first and last name, CUSTOMER NAME includes the customer's first and last name, and CUSTOMER ADDRESS includes the customer's street address, city, state, and zip code.

  • Calculated fields. The ORDER AMOUNT field contains a value that is most likely manually calculated, especially if the customer is ordering more than three items. The ITEM # EXTENSION fields are all likely to be manually calculated as well. The value for a given ITEM # EXTENSION field is the result of multiplying the value of a related QUANTITY # field by the value of a related PRICE # field. (For example: ITEM 3 EXTENSION = QUANTITY 3 x PRICE 3)

  • Unnecessary duplicate fields. Each of the fields pertaining to a particular item is a duplicate. For example, the ITEM 1, ITEM 2, and ITEM 3 fields are unnecessary duplicate fields.

  • No true primary key. There is no field or group of fields that can uniquely identify a single record in this table. The ORDER NUMBER field is not a primary key in this table; if a customer orders more than three items, you'll have to enter another record into the table using the same order number.

  • The table represents more than one subject. This table represents three subjects: customers, orders, and items. (Depending on your point of view, it also represents sales reps.)

Now that you know the elements of good database design, you're sure to avoid a design such as this.


Top

Part II: The Design Process