HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Expressing division in relational algebra in terms of other operations

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
expressingoperationsdivisionalgebraotherrelationalterms

Problem

So, I've been conferred upon the opinion that:


Union, difference, cross product, selection, projection form the "complete set of relational operations".
That is, any other relational operation can be expressed as a combination of these (excluding domain manipulation operations like aggregate functions I assume).

Question 1: Is that true ?

Question 2: If yes, can someone help me break down division in terms of those operations.

Solution

Let $R(A,B)$ and $S(B)$ be two relations. Division should find all values of A in R that are connected with all values of B (in S). Think $AB\div B=A$.

Question 1: Yes. $R\div S=\pi_A(R)-\pi_A(\pi_A(R)\times S-R)$

Question 2:

$\pi_A(R)\times S$ : this contains all possible AB pairs.

$R$ : this contains the actual AB pairs.

For the values of A that are connected to all values of B, after we do the difference, those will be gone. In the difference $\pi_A(R)\times S-R$ there are only values of A that are NOT connected to all B.

The rest is obvious.

Context

StackExchange Computer Science Q#70068, answer score: 7

Revisions (0)

No revisions yet.