Database Reference
In-Depth Information
DrID
DrName
Specialty
DrPhone
SuprDrID
45
Robert Martin
Surgery General
609-924-9248
25
36
Elaine Hsu
Urology
908-535-5228
25
13
Leroy Richardson
Oncology
908-322-5566
25
DOCTOR Relation
10
14
23
Explanation of
INTERSECTION operation
45
37
25
36
13
39
DrID
DrName
Specialty
DrPhone
SuprDrID
10
Kim Maggio
Family Practice
918-756-0831
25
14
Monika Isaac
Neurology
609-238-3377
45
23
Marcus Kulper
Internal Medicine
732-613-9313
36
37
Ira Goldman
Psychiatry
609-246-0331
13
39
Lawrence Stark
Radiology
918-613-1988
45
SUBORDDOCTOR Relation
10
14
23
Explanation of
DIFFERENCE operation
45
37
25
36
13
39
Figure 8-13
INTERSECTION and DIFFERENCE operations.
Relational algebra solution
DOCTOR :
=
SUPVRDOCTOR
«
SUBDOCTOR
Note the syntax for the operation in relational algebra and the symbol
indi-
cating the intersection operation. The intersection operation finds only those
entities that are common to both relations. Intersection operation in relational
algebra is similar to intersection function in mathematical set theory. Note the
solution shown in Figure 8-13.
«
Difference
Features and function
Operates on two relations.
Identifies the rows in one relation that are not present in the other relation.
Both relations must be union-compatible; that is, they must have the same
columns.
The result is a single relation containing rows and columns as indicated
below:
Rows—only those rows that are in the first relation but not in the second
Columns—same columns as in either of the original relations
Example
Refer to Figure 8-11 for the discussion of this operation.
Data request List all the attributes of all doctors who report to some other
doctors but have no one reporting to them. These are the doctors who are sub-
Search WWH ::




Custom Search