Databases Reference
In-Depth Information
Rep
RepNum
LastName
FirstName
Street
City
State
Zip
Commission
Rate
Customer
CustomerNum
CustomerName
Street
City
State
Zip
Balance
CreditLimit
RepNum (FK)
Columns in this
primary key are also
foreign keys
190
Orders
entity
OrderLine
entity
Part
PartNum
Description
OnHand
Class
Warehouse
Price
Dashed line
indicates nonidentifying
relationship
Orders
OrderNum
OrderDate
CustomerNum (FK)
OrderLine
OrderNum (FK)
PartNum (FK)
NumOrdered
QuotedPrice
Solid line
indicates identifying
relationship
Shape indicates
that order lines can be identified
only through relationships
with other entities
FIGURE 6-8
Final information-level design
There are some differences between the E-R diagram shown in Figure 6-8 and the ones you have seen so
far. The OrderLine entity appears as a rectangle with curved corners. Further, the relationships from Orders
to OrderLine and from Part to OrderLine are represented with solid lines instead of dashed lines.
Both of these differences are due to the fact that the primary key of the OrderLine entity contains for-
eign keys. In the OrderLine entity, both columns that compose the primary key (OrderNum and PartNum) are
foreign keys. Thus, to identify an OrderLine, you need to know the order and the part to which the order
corresponds.
This situation is different from one in which the primary key does not contain one or more foreign keys.
Consider the Customer table, for example, in which the primary key is CustomerNum, which is not a for-
eign key. The Customer table does contain a foreign key, RepNum, which identifies the Rep table. To iden-
tify a customer, however, all you need is the customer number; you do not need to know the rep number.
In other words, you do not need to know the sales rep to which the customer corresponds.
An entity that does not require a relationship to another entity for identification is called an independent
entity , and one that does require such a relationship is called a dependent entity . Thus, the Customer table
is independent, whereas the OrderLine table is dependent. Independent entities have square corners in the dia-
gram, and dependent entities have rounded corners.
A relationship that is necessary for identification is called an identifying relationship , whereas one that
is not necessary is called a nonidentifying relationship . Thus, the relationship between the Rep and
Customer tables is nonidentifying, and the relationship between the Orders and OrderLine tables is identifying.
In an E-R diagram, a solid line represents an identifying relationship and a dashed line represents a noniden-
tifying relationship.
 
Search WWH ::




Custom Search