Home > Articles


Database System Concepts

The next few sections cover database theory and implementation. These concepts will help you understand what was and was not done with the IMP database. This section can give you some ideas for future modifications. If you are interested only in installing IMP, skip to the next chapter.

Database Design Tips

After you have used IMP for awhile, you will probably want to change it. In this section, I will give you a brief overview of database design and use. The lessons learned here will give you concepts to use as you decide what information to capture.

You will also be shown how to query a database for specific information. The skills learned here will help you troubleshoot installation problems and future user problems.

System Design Overview

About 15 years ago, I learned a truth that has had a profound effect on my abilities as a designer. It is basically this: If you define every piece of data in a system and what you do to each piece of data, you have defined the system, and you know what your software must do.

This flew in the face of what I knew about flow charts and design documents. It turned out to be absolutely correct. After you have identified every piece of data, you can generate the design.

Even today, I often start the design first, and then realize I need to define my data. I then backtrack and nail down all the data. You need to do the same, especially in database design. Let's cover data definition and grouping issues.

General Database Design Issues

A good database design requires grouping the data element types together in certain ways. I will explore the methods involved using plain language and examples.

After you have IMP running, you might decide to provide a free service with IMP. There is no such thing as a free lunch, so the system has to be paid for. The most common way of financing free online services is to sell advertising space. For this to succeed, you usually need demographic data. The following examples don't have a direct bearing on the current IMP database. However, they do provide you with some concepts that will give you a handle on collecting useful data on users.

You will be taken through a database design scenario. This scenario has been chosen to illustrate database design concepts in the simplest fashion.

Let's assume that your customers live in an area famed for its best of breed dogs. You need to collect information regarding these customers and their pets for advertising demographics. We will start from the beginning concepts, and pretend we have the base information from the local veterinarian.

To begin with, let's take a brown dog. The dog is an animal of a certain type, or breed. The data are as follows:

  • Animal Type–dog
  • Breed–Black Lab

The data element types are Animal and Breed. The information concerning these types is dog and Black Lab. To store this information in a database, we could create a column named Animal, and a column named Breed. The attributes dog and brown go into the rows. With this database design, we can also insert Persian cats.

Relational Databases

Now assume you have decided to narrow the database to dogs and have expanded the information you are collecting to include owner name and phone number plus the ID tag number attached to the dog's collar.

In our example, we are dealing with dogs and owners. Therefore, it makes sense to create a dog_info table and owner_info table. Generally, you need to create as many tables as you have classes of information. This is a very intuitive process. In this case, we can classify the information by dogs and owners.

This is the beginning of a relational database. The dogs are part of the pet owner's life. In real life, a veterinarian gives the dog the owner's last name. The data in the tables is related in real life, and the information in the tables reflects that relationship. Now let's work on the tables.

Data Identification Techniques

A good way to begin on a table design is to get a notepad (electronic or otherwise), and start listing all the data element types that will be in it. A data element type is a piece of information that you can describe. The data element type is usually put into a database as a fixed-name column. The description of the data element is usually put into the database as a variable piece of information stored in a row.

In database design, a data element type is referred to as an entity, a data field, or a data column.

A data element is referred to as an entity attribute (or simply attribute), a data record, or a data row.

A data table can be called a database. The description's data table and database are used interchangeably in many books. For our use, a data table (or simply table) is a collection of data columns, and a database is a collection of data tables.

The definitions used in database theory and design have evolved over the years, and will probably continue to evolve.

It is important to determine the level of detail and the type of information covered by your data element types. It makes sense to create a column named Breed because we are doing a table that consists solely of dog families. It would not make sense to do such a column if we were doing a table cataloging all earth animals. It is generally best to hold off determining the table names until you have most of the data described. After you have done this, you can begin naming tables and columns with confidence. After the tables are done, you can start defining keys.

As far as the IMP database is concerned, we find we do not need much relational information. The user column provides the glue between the preferences table and the address table. The preferences table contains the user-settable options for his IMP usage. The address table contains the list of all that user's contacts.

Database Design Helpers

Ironically, one of the best tools for developing a database is a database! The column names for such a database could possibly be item_name, item_description, item_use, item_group, when_modified, and rules_for_modification. These can also be headings on a paper worksheet or electronic spreadsheet.

Very carefully fill in all the fields for each data item you have identified. The item_use field would contain a description of when this item would be used, such as "When dog tag number is assigned." The item_group field can simply be a number or a group description. In our example, you could group information by "dog" or "dog owner." The when_modified field would contain information such as "when dog received." The rules_for_modification field could be something such as "when payment is made."

All this information helps you decide how to arrange the data. You make up the rules, and you determine when the information is correct. Try to use very similar or the same language in the same columns whenever possible.

After you have filled in the database information, try printing it out, sorted by various columns. Sort by group, sort by modification time, and sort by rules of modification. This will give you a head start on a good database design.

Another useful tool with a free evaluation download is called dezign. It is a visual tool that runs on the Windows platform. It is available from http://www.heraut.demon.nl/dezign/index.html. The registered version removes the limits on the number of entities and attributes you can deal with during the design process. It knows about MySQL, and it holds your hand as you work with tables. It can also generate SQL scripts.


A key is a unique item. In real life, you have a key to a door. In general practice, we assume a specific key only unlocks a specific door. A key in a database works much the same way. A unique key value in a database refers to only one row. Non-unique keys are analogous to master keys that unlock more than one door. Non-unique database keys will refer to more than one row.

It is a good idea to have at least one key in every database table. Keys are used to make data lookup in databases much faster. Keys are kept in special index tables that are managed by the database, in a specific sort order. This ordering of key information allows the database engine to do lookups for specific information quickly.

In our database example, a good key would be the dog tag ID number. This number is guaranteed to uniquely identify one dog. This number will never change for the life of the dog, or most likely even after death. It is a unique key. Only one instance of that value exists.

Another key could be an owner's name or a dog's name. However, you could have many dogs named Spot, or many owners named John Smith. These would be non-unique keys. Many rows could exist containing John Smith.

Finally, we can arbitrarily decide to create a unique key. We can give each owner an ID number that is guaranteed to be unique. It is unique because we say so. The term for that is by definition. It can be an automatically incrementing number, managed by the database. Only one instance of any particular number would ever exist in the database.


A unique key managed by the auto-increment feature of the database can be considered unique. It might not be, in the strictest sense. Let's assume our database is extremely active, and our key is an auto-increment integer with an upper limit of about 4 billion. If we were putting 1 billion pets a year into the database, we would run out of unique keys in 4 years. However, if we put in one dog per hour, 24 hours a day, we would only put in about 9,000 pets per year. It would take somewhere around 500,000 years (a very rough approximation) to use all the keys in the database.

For all practical purposes, auto-increment keys can be considered totally unique and infinitely large. In this case, infinity is a relative concept.

In our example, the dog tag ID number is the key for the dog_info database. We will put a unique ID number in the owner_info database and make it a key.

Correct Utilization of Data

Now we need to determine how to relate the dogs to the owners. We can store the owner's name with each dog. We can also store the dog ID numbers with each owner. However, each of these solutions presents problems.

If we store the owner's name with each dog, we are taking up a lot of space in the database for each dog we enter. If we store the tag ID number for each dog with the owner, we have to worry about leaving enough room in the owner table to make sure we cover any number of dogs for that person. This is clearly very difficult.

Each of these solutions provides duplicate information. Also, if an owner should legally change her name, the amount of work necessary to correct the information in the database is quite large. Normalization is the name for the technique of correcting duplication of data.

Normalization is a term used for minimizing data duplication in a database. In other words, don't put the name "John Smith" in more than one database table. As you start considering the issues in handling this concept, you will begin to see it is simply the use of common sense. However, professors who teach database theory have come up with terms to describe this common-sense approach.

This leads to confusion for the people who have never heard this term. Also, unless you have thought through the ramifications of normalization, some surprises are in store. I use plain English to explain normalization. You might find that different database books explain normalization using different languages. Some books explain better than others.

To start normalizing, you must group the data properly. Generally, put the highest level concept into its own table. (Examples are dog_info and owner_info.) After that, create columns to hold data element types (or entities). The attributes of these entities are the entries (rows) in the database.

After you have done this, go over the database and look for duplicate information. In our example, let's assume the owner's name is initially stored in the dog_info table and in the owner_info table. Our table information looks something like this:

TABLE: dog_info    TABLE: owner_info
OwnerName       OwnerName
Breed         Phone
DogName        OwnerIDNumber (KEY)
IDTagNumber (KEY)

Because we have the owner's name in two tables, we have duplicate information. If we consider the type of data carefully, we also realize we have a one-to-many relationship between the two tables. One owner can own many dogs. However, for the sake of illustration, one dog belongs to only one owner.

The problems we find in the sample tables illustrate the reasons for normalization. Several named normalization steps exist. The steps have technical terms not covered here. To do further study, a good book is Codd's Further Normalization of the Data Base Relational Model, 1972.

The first step in normalizing data is achieved when we have identified all data element types properly. In its simplest case, we have not achieved this step if we have made a table name a column. If we had made owner_info a column name, we would have a normalization problem. The problem is obvious when we realize the owner has several attributes. In our example, they are the owner's name and the owner's phone number. We can say, "The phone number is owner information." We can also say, "The owner's name is owner information." Both statements are true. However, this would lead to having multiple values for an owner info column.

After we realize this, we realize the owner_info belongs in a table. We then set separate columns for the attributes. This solves the problem of trying to stuff a table into a column. Removing all these types of problems is our goal.

The next step is to see that data is not duplicated across tables or within a table. In our example, because an owner can own multiple dogs, putting the owner's name in the dog_info table along with the reference ID pointing to the owner info table causes duplication of information in that table and in the owner_info table.

The name is repeated for each dog owned, and occurs once in the owner_info table. Errors can creep in, and misspellings of the owner's name can cause confusion. The data is also redundant because following the reference ID gives you the ability to recover the Owner's name.

To solve this, we place the name in one location where it appears once. The interesting thing about an owner is there is only one owner for a dog. Therefore, the owner name is relatively unique, and should show up in the database system only once. We handle this by removing the owner's name from the dog_info table.

This leaves us with another possible problem. For example, if we were to put State Name and a two-letter State Abbreviation in the address in owner_info, we would have a future problem. Whenever the State Name changed, the State Abbreviation would also have to change. At the same time, having both pieces of information in the owner_info table adds nothing to the owner_info table's data store.

The solution is to create a new table that lists State Name for State Abbreviation. You then would use either a State Abbreviation in the owner_info table, or an ID in that table to look up the State Name.

Finally, note that the rules in the second step are technically broken in our final design. There are two problems. The first problem is that the Breed column is the name of the Breed, rather than a Breed ID. Because Breed names repeat, and can be misspelled, this is not a good thing. To finish out the design, the Breed column needs to be an ID that references to a Breed table. If you decide to create this table, you should modify the database design to accommodate this change.

The second problem is that the owner's ID number is in the dog table, and it repeats for each dog the owner owns. This will always happen in a one-to-many relationship. Note, however, that the database design is clean, because changing information such as the phone number of the owner will affect all dogs owned. When you look up the dog's table entry using the IDTagNumber, you can then look up the owner's table entry by the using OwnerIDNumber. At this point you have the correct phone number. You can also find all dogs owned by the owner by finding all rows that have that specific OwnerIDNumber.

Our final database looks like this:

TABLE: dog_info    TABLE: owner_info
FKOwnerIDNumber (KEY)  OwnerName
Breed         Phone
DogName        OwnerIDNumber (KEY)
IDTagNumber (KEY)

You will see that the FKOwnerIDNumber in the dog_info table is defined as a key. This will be a non-unique key. Telling the database that it is a key will speed lookups of which dogs an owner has. This is a perfectly legitimate use of a key.

Modifications to the IMP Database

These concepts can be applied to your study of the IMP database design. As you examine the IMP tables, you find they are very short and very easy to understand. This is the KISS principal at work. There is one duplicate piece of data (the username is repeated between tables), but this is not a fatal mistake.

The IMP tables can be improved and enhanced. The most obvious enhancement is to change the user column to a key column in one of the tables. You would need to create a unique ID column and reference this in the other table. This would provide faster lookup. However, in personal experience, the IMP table supports about one thousand users very well. The amount of re-work of the PHP code to accomplish this could cause you much grief and cost time.

If you decide to store extra information in the IMP database, I recommend that you place your changes in separate tables using a key loosely based on the username. A username must be unique within an email system. Alternatively, because a Social Security Number is unique, it is a good key for identifying individuals. Another fairly unique ID is the username linked with the user phone number, though this can repeat in rare circumstances. Unless you really want to do a lot of rework of the PHP code, leave the current table structures alone and enhance the database with separate tables.

In other words, break the database design rules for simple changes! This will cause fewer problems in the long run, because the only code that will break is the new code you added. That is part of the KISS principal. When modifying an existing system, change as little of the current system as possible, unless the gain outweighs the pain. This is true even if the current system is poorly designed.

Graphical Database Representations

Many ways exist to design databases graphically. I like to use rectangular boxes with lines connecting them. The name of the table is at the top of the rectangular box, enclosed with lines to set it apart.

Each data element in the table is listed below the table name. A bullet or asterisk indicates which element is a key. A line goes from one table to another table where a relationship exists. I like to draw a line from the data element in one table to the corresponding data element in the next table.

Our sample database is shown in Figure 3.1. The good thing about this particular graphical approach is that it can be worked on the back of a napkin! When done, it will transfer easily into a drawing program. It is a matter of taste. You should feel free to look for a table representation method you prefer.

Figure 3.1 The sample database in graphic form as created in Dezign.


InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020