Specifications
Tables
Relational databases are made up of relations, more commonly called tables. A table is exactly
what it sounds like—a table of data. If you’ve used an electronic spreadsheet, you’ve already
used a relational table.
Let’s look at an example.
In Figure 7.1, you can see a sample table. This contains the names and addresses of the cus-
tomers of a bookstore, Book-O-Rama.
Designing Your Web Database
C
HAPTER 7
7
DESIGNING YOUR
WEB DATABASE
173
CustomerID
CUSTOMERS
Name Address City
1 Julie Smith 25 Oak Street Airport West
2 Alan Wong 1/47 Haines Avenue Box Hill
3 Michelle Arthur 357 North Road Yarraville
FIGURE 7.1
Book-O-Rama’s customer details are stored in a table.
The table has a name (Customers), a number of columns, each corresponding to a different
piece of data, and rows that correspond to individual customers.
Columns
Each column in the table has a unique name and contains different data. Each column has an
associated data type. For instance, in the Customers table in Figure 7.1, you can see that
CustomerID is an integer and the other three columns are strings. Columns are sometimes
called fields or attributes.
Rows
Each row in the table represents a different customer. Because of the tabular format, they all
have the same attributes. Rows are also called records or tuples.
Values
Each row consists of a set of individual values that correspond to columns. Each value must
have the data type specified by its column.
Keys
We need to have a way of identifying each specific customer. Names usually aren’t a very
good way of doing this—if you have a common name, you’ll probably understand why. Take
10 7842 CH07 3/6/01 3:34 PM Page 173