CS457 Syllabus & Progress

## Express Set Division with other Relational Algebra operations

• Set division is a not a neccessary operator in Relation Algebra

• Fact:

 The set division operator is not a necessary operator !!!

because:

 We can accomplish the set division operation using a serie of other Relational Algebra operations

• Expressing the division operation in terms of other relational algebra operations

• The set division operation can be expressed as a sequence of other relational algebra operations

• The steps are easier to understand using a concrete example....

• Consider the following content of the Emp_Proj and emp4_proj relations:

• OK, I will now show the steps the achieve "set division.

For each step, I will show the result using the above database content (as illustrative example)

1. construct a "minimum qualifying" relation (SSN, Part#) :

The "minimum qualify" relation will contain the following:

Meaning of this relation:

 This relation contains the tuples that is necessary for each employee to be selected by the query

The "qualify" relation can be constructed as follows:

 qualify   =   π ssn (Emp_Proj) × emp4_proj

2. Compute the difference "qualify - Emp_Proj":

If we project out the SSN from the difference set, we will obtain all disqualified SSNs !!!

3. The last step is to obtain the set of qualified SSN, that's simple use set difference again:

 π ssn (Emp_Proj) − π ssn (UnQualify)

• Summary: the division of relation R1(A,B) by relation R2(B) can be obtained using this sequence of set algebra operations: