Database Reference
In-Depth Information
Note the symbol :
used to perform the assignment of the result and name the
resulting relation as PATIENT-15. There are no keywords.
=
Union
Features and function
Operates on two relations.
Combines two relations.
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—all the rows from both relations, duly eliminating any duplicate rows
Columns—same columns as in either of the original relations
Example
In the database of a medical center, there are two relations representing data
about the doctors. One relation, SUPVRDOCTOR, represents data about
doctors with supervisory responsibilities who have other doctors reporting to
them. The other relation SUBDOCTOR represents data about every doctor
who reports to another doctor. Figure 8-11 shows these two tables with data
in the rows and columns.
Data request List all the attributes of all the doctors in the medical center. Call
the result relation ALLDOCTOR.
DrID
10
14
23
37
39
DrName
Specialty
DrPhone
918-756-0831
609-238-3377
732-613-9313
609-246-0331
918-613-1988
SuprDrID
25
45
36
13
45
SUBDOCTOR
Relation
Kim Maggio
Family Practice
Monika Isaac
Neurology
Marcus Kulper
Internal Medicine
Ira Goldman
Psychiatry
Lawrence Stark
Radiology
45
Robert Martin
Surgery General
609-924-9248
25
36
Elaine Hsu
Urology
908-535-5228
25
25
13
Leroy Richardson
Oncology
908-322-5566
SUPVR DOCTOR
Relation
DrID
25
45
36
DrName
Specialty
DrPhone
609-238-5100
609-924-9248
908-535-5228
SuprDrID
Roger Smarts
Neurology
Robert Martin
Surgery General
25
25
Elaine Hsu
Urology
13
Leroy Richardson
Oncology
908-322-5566
25
Figure 8-11
SUBDOCTOR and SUPVRDOCTOR relations.
Search WWH ::




Custom Search