Database Reference
In-Depth Information
Alias(es)
This is a name (or set of names) that you use for the field in very
rare
circumstances.
One instance in which you would use an alias is when there
must
be two occurrences of
the field in the
same
table. Let's assume that an organization is accustomed to identifying
its employees by unique values within an E
MPLOYEE
ID N
UMBER
field. Now, consider the
SUBSIDIARIES table structure in
Figure 9.2
(this is a
partial
structure only).
Figure 9.2. A table requiring two occurrences of the same field
In this instance, each subsidiary has a president and a vice president. Both of these indi-
viduals
must
be represented in the table because of their positions within the subsidiary
organization, so there are two E
MPLOYEE
ID N
UMBER
fields in the table structure. Proper
databasedesign,however,dictatesthattherecanonlybe
one
occurrenceofthisfieldwithin
the table; there is an obvious problem here. The only solution is to use an alias for one or
both occurrences of the E
MPLOYEE
ID N
UMBER
field. For instance, you could (for sake of
clarity) use P
RESIDENT
ID as an alias for the first occurrence of E
MPLOYEE
ID N
UMBER
and
V
ICE
P
RESIDENT
ID as an alias for the second occurrence of E
MPLOYEE
ID N
UMBER
. With
the aliases in place, both employees are properly represented within the table.
Figure 9.3
shows the revised table structure.