For example, suppose you run a small company that sells widgets and you
have a computerized database of customers. In addition to storing each
customer’s name, address, and phone number, you want to be able to look up
outstanding order and invoice information for any of your customers. You
could use three related tables in an RDBMS to store and organize customer
data for just those purposes. Figure 28.3 shows an example of such a
database.
FIGURE 28.3 You can use three related tables to track customers, orders, and
outstanding invoices.
In the example in Figure 28.3, we have added a cid field to each customer
record. This field holds a customer ID number that is the unique piece of
information that can be used to link all other information for each customer to
track orders and invoices. Each customer is given an ID unique to him; two
customers might have the same data in their name fields, but their ID field
values will never be the same. The cid field data in the orders and
overdue tables replaces the last_name, first_name, and
shipping_address field information from the customers table. Now,
when you want to run a search for any customer’s order and invoice data, you
can search based on one key rather than multiple keys. You get more accurate
results in faster, easier-to-conduct data searches.
Now that you have an idea of how data is stored in an RDBMS and how the