Database Reference
In-Depth Information
EmployeeNumber
FirstName
LastName
Department
Email
Phone
100
Jerry
Johnson
Accounting
JJ@somewhere.com
834-1101
200
Mary
Abernathy
Finance
MA@somewhere.com
834-2101
300
Liz
Smathers
Finance
LS@somewhere.com
834-2102
TC@somewhere.com
400
Tom
Caruthers
Accounting
834-1102
Fax:
834-9911
Home:
723-8795
500
Tom
Jackson
Production
TJ@somewhere.com
834-4101
600
Eleanore
Caldera
Legal
EC@somewhere.com
834-3101
Fax:
834-9912
Home:
723-7654
Legal
RB@somewhere.com
834-3102
700
Richard
Bandalone
Figure 3-7
Nonrelational table—Order
of rows Matters and Kind of
Column Entries Differs
in Email
In a relation, the order of the rows and the order of the columns are immaterial. No in-
formation can be carried by the ordering of rows or columns. The table in Figure 3-7 is not a
relation because the entries for employees Caruthers and Caldera require a particular row ar-
rangement. If the rows in this table were rearranged, we would not know which employee has
the indicated Fax and Home numbers.
Finally, according to the last characteristic in Figure 3-4, for a table to be a relation, no two
rows can be identical. As you learned in Chapter 2, some SQL statements do produce tables
with duplicate rows. In such cases, you can use the DISTINCT keyword to force uniqueness.
Such row duplication only occurs as a result of SQL manipulation. Tables that you design to be
stored in the database should never contain duplicate rows.
By The WAy Do not fall into a common trap. Even though every cell of a relation must
have a single value, this does not mean that all values must have the same
length. The table in Figure 3-8 is a relation even though the length of the Comment col-
umn varies from row to row. It is a relation because, even though the comments have
different lengths, there is only one comment per cell.
Alternative Terminology
As defined by Codd, the columns of a relation are called attributes and the rows of a relation
are called tuples (rhymes with “couples”). Most practitioners, however, do not use these aca-
demic-sounding terms and instead use the terms column and row. Also, even though a table is
not necessarily a relation, most practitioners mean relation when they say table. Thus, in most
conversations the terms relation and table are synonymous. In fact, for the rest of this topic
table and relation will be used synonymously.
Additionally, a third set of terminology also is used. Some practitioners use the terms
file , field , and record for the terms table, column, and row, respectively. These terms arose
from traditional data processing and are common in connection with legacy systems.
Sometimes, people mix and match these terms. You might hear someone say, for example,
 
Search WWH ::




Custom Search