Specifications

Designing Your Web Database
C
HAPTER 7
7
DESIGNING YOUR
WEB DATABASE
177
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
ISBN
BOOKS
Author Title Price
0-672-31687-8 Michael Morgan Java 2 for Professional Developers 34.99
0-672-31745-1 Thomas Down Installing Debian GNU/Linux 24.99
0-672-31509-2 Pruitt, et al. Teach Yourself GIMP in 24 Hours 24.99
OrderID
ORDERS
CustomerID Amount Date
1 3 27.50 02-Apr-2000
2 1 12.99 15-Apr-2000
3 2 74.00 19-Apr-2000
4 4 6.99 01-May-2000
OrderID
ORDERS
CustomerIDAmount Date
12 1199.50 25-Apr-2000
13 143.00 29-Apr-2000
14 115.99 30-Apr-2000
15 123.75 01-May-2000
Name
Julie Smith
Julie Smith
Julie Smith
Julie Smith
Address
28 Oak Street
28 Oak Street
28 Oak Street
28 Oak Street
City
Airport West
Airport West
Airport West
Airport West
FIGURE 7.3
The initial schema consists of Customers, Orders, and Books.
FIGURE 7.4
A database design that stores redundant data takes up extra space and can cause anomalies in the data.
The second problem is that it can lead to update anomalies, that is, situations where we change
the database and end up with inconsistent data. The integrity of the data is violated and we no
longer know which data is correct and which incorrect. This generally leads to losing informa-
tion.
Three kinds of update anomalies need to be avoided: modification, insertion, and deletion
anomalies.
If Julie moves house while she has pending orders, we will need to update her address in three
places instead of one, doing three times as much work. It is easy to overlook this fact and only
change her address in one place, leading to inconsistent data in the database (a very bad thing).
These problems are called modification anomalies because they occur when we are trying to
modify the database.
10 7842 CH07 3/6/01 3:34 PM Page 177