Database Reference
In-Depth Information
EMPLOYEE Relation
SocSecNumber
214-56-7835
123-44-5546
EmployeeName
Robert Moses
Kassia Raj
Andrew Baron
Samuel Kahn
Kaitlin Hayes
Carey Black
Amanda Lupo
Position
Programmer
Analyst
Programmer
Analyst
Analyst
Data Analyst
DBA
213-36-7854
311-33-4520
512-22-8542
PROJECT Relation
ProjID
DBSE
ProjName
Database
Order Entry
Inventory Control
Billings
Sales Analysis
Manager
Silverstein
Brooks
McKeown
Sharma
Chen
INCT
SALE
ASSIGNMENT Relation
SocSecNumber
214-56-7835
512-22-8542
ProjID
DBSE
ORDE
INCT
BILL
SALE
DBSE
DBSE
StrtDate
1-Jan
1-Mar
1-Mar
15-Apr
15-Jan
1-Apr
1-Feb
213-36-7854
311-33-4520
512-22-8542
Figure 8-7
Entity integrity rule.
denotes which specific entity? In the case of the relation ASSIGNMENT, even if
only part of the primary key contains null values for any rows, the entity integrity
rule is violated.
Referential Integrity
You have noted that foreign keys establish relationships between tables or relations.
The value placed in the foreign key column of one table for a specific row links to
a row with the same value in the primary key column in another table. Figure 8-8
shows two relations, DEPARTMENT and EMPLOYEE.
Note how the values in the foreign key column DeptNo in the EMPLOYEE rela-
tion and in the primary key column DeptNo in the DEPARTMENT relation link
related rows in the two relations. In the figure, employee Charles is assigned to
department Accounting and employee Eldon is assigned to Marketing. What about
employee Mary, who is supposed to be assigned to department D555, but the data-
base does not have department D555? Look at the row for employee Paul. This row
has a null value in the foreign key column. Is this allowed? What do null values in
foreign key columns indicate? You know that null values in foreign key columns
Search WWH ::




Custom Search