Databases Reference
In-Depth Information
which shows not only the name of the entity class, but also the names of the attributes in
the table scheme for this class. You can also think of a table scheme as the column
headings row (the top row) of any table that is formed using that table scheme. (I will
present an example of this shortly.)
We have defined the concepts of a superkey and a key for entity classes. These concepts
apply equally well to table schemes, so we may say that the attributes {A,B} form a key
for a table scheme, meaning that they form a key for the entity class implemented by that
table scheme.
3.1.2 Implementing Entity Sets—Tables
In a relational database, each entity set is modeled by a
table
. For example, consider the
BOOKS table shown in Table 3-1, and note the following:
The first row of the table is the table scheme for the
Books
entity class.
•
Each of the other rows of the table implements a
Books
entity.
•
The set of all rows of the table, except the first row, implements the entity set
itself.
•
Table 3-1. The BOO
K
S table from the LIBRARY databas
e
ISBN
Title
Price
0
-12-333433-3
On Liberty
$
25.00
0-103-45678-9
Iliad
$25.00
0
-91-335678-7
Faerie Queene
$
15.00
0-99-999999-9
Emma
$20.00
1
-22-233700-0
Visual Basic
$
25.00
1-1111-1111-1
C++
$29.95
0
-91-045678-5
Hamlet
$
20.00
0-555-55555-9
Macbeth
$12.00
0
-99-777777-7
King Lear
$
49.00
0-123-45678-0
Ulysses
$34.00
0
-12-345678-9
Jane Eyre
$
49.00
0-11-345678-9
Moby-Dick
$49.00
0
-321-32132-1
Balloon
$
34.00
0-55-123456-9
Main Street
$22.95
More formally, a table
T
is a rectangular array of elements with the following properties:
The top of each column is labeled with a distinct
attribute name
A
i
. The label A
i
is also called the
column heading
.
•
The elements of the
i
th column of the table
T
come from a single set D
i
, called
the
domain
for the
i
th column. Thus, the domain is the set of all
possible
values
for the attribute. For instance, for the BOOKS table in Table 3-1, the domain D
1
is
the set of all possible ISBNs, and the domain D
2
is the set of all possible book
titles.
•