Spreadsheet Design

   

Flat-File Design

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 . S ALES R EP N AME includes the sales rep's first and last name , C USTOMER N AME includes the customer's first and last name, and C USTOMER A DDRESS includes the customer's street address, city, state, and zip code.

  • Calculated fields . The O RDER A MOUNT field contains a value that is most likely manually calculated, especially if the customer is ordering more than three items. The I TEM # E XTENSION fields are all likely to be manually calculated as well. The value for a given I TEM # E XTENSION field is the result of multiplying the value of a related Q UANTITY # field by the value of a related P RICE # field. (For example: I TEM 3 E XTENSION = Q UANTITY 3 x P RICE 3)

  • Unnecessary duplicate fields . Each of the fields pertaining to a particular item is a duplicate. For example, the I TEM 1, I TEM 2, and I TEM 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 O RDER N UMBER 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


Database Design for Mere Mortals[c] A Hands-On Guide to Relational Database Design
Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design
ISBN: 0201694719
EAN: 2147483647
Year: 2002
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net