|
A database is an organized collection of information.
Doesn't say much, does it? But that's really
all there is to it. The information can be anything
from a customer's phone number to a movie complete
with pictures and sound. Anything that can be
stored digitally can be stored within a database. The "organization" comes from the use of one or more "keys" such as customer ID, customer name, warehouse number, bin number, and so forth.
Databases can be organized in several ways.
Flat File
The simplest is the so-called flat file.
Information is placed sequentially with one record
following another, much like words follow each
other in this sentence. To access a record in
a flat file, all of the records in front of it
must be read, or at least bypassed. If you wish
to access the records in a particular order, the
flat file must first be sorted and recreated in
the new order.
A data tape is an example of a flat file.
Hierarchical
Hierarchical databases work on a parent - child
scheme. For instance, a parent might be a Customer
ID number. The first level children might include
the Customer Name, Description, main address,
and main contact. The next level could contain
more addresses under the main address record and
the address and phone number of the main contact.
It would look like this:

Hierarchical databases can be navigated
either directly or sequentially although sequential
navigation has its own special rules.
Relational
The most recent and popular database
format is relational.
Think of a relational database as
a collection of tables such as in a spreadsheet.
In such a database, one table may
hold the basic information of a customer: the
CustomerID, Customer Name, Description, Main Address,
Legal Service ID, and Contact ID.
Another table could hold a shipping
address for each customer warehouse consisting
of CustomerID, Customer Warehouse ID, Warehouse
address, etc.
The tables could look like these:
Customer Table:
|
CustID
|
Name
|
Descr
|
MAddr
|
LegalSvc
|
Contact
|
| Cust01 |
Viking Waters |
Consultant |
PO 1975, Elma, WA 98541 |
L01 |
Al Kalar |
| Cust02 |
We Takum |
CPA |
456 WallStreet, New York,
NY 12345 |
L02 |
M Waterboy |
Warehouse Table:
|
CustID
|
Whse
ID
|
Address
|
Phone
|
| Cust01 |
Whs01 |
456 Unknown
Ln, Elma, WA 98541 |
360-482-1149 |
| Cust01 |
Whs02 |
124 Youfoundit
St., Seattle, WA 98124 |
555-123-4567 |
| Cust02 |
Whs01 |
1234 567nd St.,
Milton, WA 98354 |
555-123-1234 |
Legal Services:
|
Legal
ID
|
Name
|
Address
|
Phone
|
| L01 |
Eisenhower &
Carlson |
1201 Pacific
Ave., Tacoma, WA |
253-572-4500 |
| L02 |
Ambulance Chaser
& Assoc. |
Phone Booth
at 4th x Pine, Seattle, WA |
206-123-4567 |
Relational databases can be accessed
directly or in just about any sequence. Information
from tables can by joined for any purpose which
is why it is called relational. For instance,
to ship an item to a customer at a particular
warehouse, you would find the customer and retrieve
his name, then get the warehouse address by matching
the CustID and Whse ID and then print the shipping
label and manifest. The data retrieval operation
can be done in one SQL command (assuming this
database uses Structured Query Language):
SELECT
CustName, WhseAddress
FROM CustomerTable, Warehouse
Table
WHERE CustID in CustomerTable =
'Viking Waters'
AND CustID
in WarehouseTable = CustID in CustomerTable
AND WhseID
= 'Whs01'
|