Step 3
Assigning
“Primary Keys” to the lists
The numbers that have been added to each list
will be used to identify who wrote what book.
For now, it’s sufficient that the numbers that we have assigned to each
row in each list
help us to uniquely identify each row in each list.
These numbers are called “Primary Keys” and each one uniquely an author or a
tile.
Now is a good time to introduce the database “table” :
The lists that are shown above are tables – it’s that simple.
A “table” is simply another word for a list,
and can have as many rows as there are items in the list, or “table.”
Each column in each table describes something about the items in that
list.
For example, the title is one “attribute” that describes the book,
but there could be other “attributes,” such as the publisher and year it was
published, etc.
The only attribute for each author will
be the author’s name,
although we could store the author’s agent, among other things that describe
the author.
However, we will keep it simple for now by using only one attribute for
each in these examples,
plus one column in each table to store the number of the record that contains
the data.
Although we are storing the record number in each table,
the important number is the primary key in the “Authors” table.
For example, we could say that book # 3 was written by author # 1,
meaning that “2001 : A Space Odyssey” was
written by Arthur C. Clarke.
|
TitleNo |
Titles |
|
AuthorNo |
Authors |
|
1 |
Lost
Worlds of 2001 |
|
1 |
Arthur C. Clarke |
|
2 |
Childhood's
End |
|
2 |
Ayn Rand |
|
3 |
2001 : A Space Odyssey |
|
3 |
Dan Brown |
|
4 |
2010 :
Odyssey Two |
|
4 |
David
Alexander |
|
5 |
2061 :
Odyssey Three |
|
5 |
Douglas
Adams |
|
6 |
3001 : Final
Odyssey |
|
6 |
Georges Simenon |
|
7 |
The Moon
Is a Harsh Mistress |
|
7 |
Isaac
Asimov |
|
8 |
A Fall of
Moondust |
|
8 |
Douglas
Adams |
|
9 |
Breaking
Strain |
|
9 |
Joe Haldeman |
|
10 |
Maelstrom |
|
10 |
Douglas
Adams |
|
11 |
Hide and
Seek |
|
11 |
Michael
Crichton |
|
12 |
Tales
from Planet Earth |
|
12 |
Nella Parson |
|
13 |
Rendezvous
with Rama |
|
13 |
Richard
Prather |
|
14 |
Rama Revisited |
|
14 |
Robert
Heinlein |
|
15 |
Atlas
Shrugged |
|
15 |
Scott Turow |
|
16 |
Fountainhead |
|
16 |
Tony
Fiore |
|
17 |
Deception
Point |
|
|
|
|
18 |
Digital
Fortress |
|
|
|
|
. . . . . . |
|
|
|
|
|
|
|
|
||
|
51 |
For Us,
the Living |
|
|
|
|
52 |
Glory
Road |
|
|
|
|
53 |
Pleading
Guilty |
|
|
|
|
54 |
Burden of
Proof |
|
|
|
|
55 |
The
Corvair Decade |
|
|
|