0
$\begingroup$

I try to understand how the relational division can be expressed by primitive operations of the relational algebra. So, I found this formula (I writed it such as I found it in the same format):
$A \DIVIDEBY B = A[X] \MINUS ((A[X] \TIMES B) \MINUS A)[X]$
But I can't get this. If we use $\TIMES$ (the Cartesian product) then A and B relations can't have same attributes, so we need to rename these attributes, i.e.:
If we have $A \{A_1, A_2, A_3\};B \{A_1, A_2, A_4\}$
then the header of the result relation will be
$\{A_{11},A_{21},A_3,A_{12},A_{22},A_4\}$,
it's okay... But next I need to apply $\MINUS$ but I can't make it because my relation header diffs from $A$.
It means that it requires yet operations (i.e. $\PROJECT$ and $\RENAME$), it isn't? Can anyone explain me more details by this expression?

$\endgroup$
2
  • 2
    $\begingroup$ Your pseudo-LaTeX doesn't work. Please fix. What I can read looks wrong. The LHS has no $X$ whereas it is a free variable of the RHS. Finally, it might help if you named the source of the formula that you find confusing. $\endgroup$
    – Kai
    Commented Feb 13, 2017 at 10:50
  • $\begingroup$ @Kai, it's from the book: C.J. Date - An Introduction to Database Systems (8th Edition). $\endgroup$ Commented May 8, 2017 at 0:07

1 Answer 1

1
$\begingroup$

The usual form of Division requires that the attributes in B are a subset of the attributes in A. And the result of the Division has just the attributes particular to A -- that is A[X] in your formulation.

I'm not sure if you understand that A[X] is a projection. So the Heading of A[X] TIMES B is exactly the Heading of A. So the inner MINUS is dealing with the same Headings -- that is, Heading of A. Then the [X] at the end of the formula is again a projection; so the outer MINUS is also dealing with the same Headings -- this time [X].

This answers much the same question (using a different notation): Expressing division in relational algebra in terms of other operations See my comments about the various different forms of 'Relational Division'.

And please note: relations have Headings, not 'Headers'.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.