Too Few Tables

More Database Design Mistakes To Avoid

One program that I inherited just wasn’t making sense.

The load of this program loaded data into a single table.  It retrieved data into a few fields.  Then did loop de loops, reading these initial fields, and compared them to hard coded values in the program.  Finally updated the remaining fields, based on the hard coded values in the program.

Eventually it dawned on me.  There was a functional dependency, violating 2NF.  The first field, determined the second field.  This of course should have been moved into another table, but it wasn’t.

Too Few Tables - Not in 2NF

Difficult maintenance.

Subsequently, we had to run distinct queries against the larger table, to find the list of codes, instead of in the lookup table.


Too Few Tables, 2NF, corrected

Create the lookup table, and a one to many relationship.

In this case, a mapping table might also be created.

Oddly enough:   The really crazy thing was, that both this mistake, too few tables, and the other mistake, of too many tables, were both done by the very same person!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: