Java Reference
In-Depth Information
Tables, Rows, Columns, and Keys
Codd's Information Rule (Rule 1) states that all data in a relational database must be
explicitly represented at the logical level as values in tables and in no other way. In
other words, tables are the basis of any RDBMS. Tables in the relational model are
used to represent collections of objects or events in the real world. A single table
should represent a collection of a single type of object, such as customers or
inventory items.
All relational databases rely on the following design concepts:
 
All data in a relational database is explicitly represented at the logical level as values in tables.
 
Each cell of a table contains the value of a single data item.
 
Cells in the same column are members of a set of similar items.
 
Cells in the same row are members of a group of related items.
 
Each table defines a key made up of one or more columns that uniquely identify each row.
The preceding ideas are illustrated in Table 1-2 , which shows a typical table of names
and addresses from a relational database. Each row in the table contains a set of
related data about a specific customer. Each column contains data of the same kind,
such as First Names, or Middle Initials, and each cell contains a unique piece of
information of a given type about a given customer.
Table 1-2: Customers Table
ID
FIRST_NAME
MI
LAST_NAME
STREET
CITY
ST
ZIP
100
Michael
A
Corleone
123 Pine
New York
NY
10006
101
Fredo
V
Corleone
19 Main
New York
NY
10007
103
Francis
X
Corleone
17 Main
New York
NY
10005
106
Kay
K
Adams
109
Maple
Newark
NJ
12345
107
Francis
F
Coppola
123
Sunset
Hollywood
CA
23456
108
Mario
S
Puzo
124 Vine
Hollywood
CA
23456
The ID column is a little different from the other columns in that, rather than
containing information specific to a given customer, it contains a unique, system
assigned identifier for the customer. This identifier is called the primary key. The
importance of the primary key is discussed in Chapter 2 .
This simple table illustrates two of the most significant requirements of a relational
database, which are as follows:
 
Search WWH ::




Custom Search