Database Reference
In-Depth Information
PATIENT Relation
BILLING Relation
BilledCharges
150.00
225.00
315.00
195.00
BldPatientNo
1234
2345
1234
2345
PatientNo
1234
2345
3456
DischargeDate
10-Feb
22-Feb
5-Mar
DISCHRGPATIENT Relation --- three types
PatientNo
1234
2345
1234
2345
DischargeDate
10-Feb
22-Feb
10-Feb
22-Feb
BldPatientNo
1234
2345
1234
2345
BilledCharges
150.00
225.00
315.00
195.00
Result of
equijoin
PatientNo
1234
2345
1234
2345
DischargeDate
10-Feb
22-Feb
10-Feb
22-Feb
BilledCharges
150.00
225.00
315.00
195.00
Result of
natural join
PatientNo
1234
2345
1234
2345
3456
DischargeDate
10-Feb
22-Feb
10-Feb
22-Feb
5-Mar
BilledCharges
150.00
225.00
315.00
195.00
Result of
outer join
Figure 8-15
JOIN operation.
connect these pieces of data across the two relations based on equal values in
PatientNo columns that are common to both relations. Natural join operation
accomplishes this task.
Also note the other two types of join operations illustrated in Figure 8-15.
Divide
Features and function
Operates on two relations.
The divide operation is the reverse of the product operation.
The result is a single relation containing rows and columns as indicated
below:
Rows—rows in one relation matching with every row in another relation
Columns—all and only columns of the first relation,
but not of the
second
Example
Refer to Figure 8-16 for the discussion of this operation. Note the three relations
A, B, and C.
Divide relation B by relation C, giving A as the result relation. The following con-
ditions apply:
Search WWH ::




Custom Search