Java Reference
In-Depth Information
One -to-many relationships are also sometimes called parent-child or master-detail
relationships because they are commonly used for lookup tables. The relationship
between the Orders Table and the Ordered_Items Table is an example of a
one-to -many relationship, where a single order corresponds to multiple ordered
items.
Many-to-many relationships
In a many-to-many relationship, every row in the first table can have many
corresponding rows in the second table, and every row in the second table can have
many corresponding rows in the first table. Many-to-many relationships can't be
directly modeled in a relational database. They must be broken into multiple
one-to -many relationships.
The Ordered_Items Table illustrates how a many-to-many relationship can be broken
into multiple one-to-many relationships. In the customer orders example illustrated by
Tables 1 -4 through 1-6, orders and inventory are related in a many-to -many
relationship; multiple inventory items can correspond to a single order, and a single
inventory item can appear on multiple orders. The Ordered_Items Table is used to
implement a one -to-many mapping of inventory items to orders.
Views
Codd's View Update Rule (Rule 6) states that data can be presented to the user in
different logical combinations, called views. All views must support the same range of
data-manipulation capabilities as are available for a table.
Views are implemented in a relational database system by allowing the user to select
data from the database to create temporary tables, known as views . These views are
usually saved by name along with the selection command used to create them. They
can be accessed in exactly the same way as normal tables.
Frequently, views are used to create a table that is a subset of an existing table.
Table 1 -7 is a typical example, showing rows from Table 1-2 (where Last_Name =
'Corleone', and City = 'New York').
Table 1-7: View of New York Corleones
ID
FIRST_NAME
MI
LAST_NAME
STREET
CITY
ST
ZIP
100
Michael
A
Corleone
123 Pine
New York
NY
10006
101
Fredo
X
Corleone
19 Main
New York
NY
10007
103
Francis
X
Corleone
17 Main
New York
NY
10005
 
Search WWH ::




Custom Search