Question

Problem

When there exists two sets, R and S, and we take the difference R - S, we remove the elements from R that exist in S.

For cases where the number of columns are the same on both sides, such as the example below, this works fine:

enter image description here

Question

However, what happens when R and S have a different amount of columns?

Was it helpful?

Solution

If I recall, the difference operation requires the two relations involved to be compatible, implying that they should have the same number of columns.

Quoting from Wikipedia about relational algebra

For set union and set difference, the two relations involved must be union-compatible—that is, the two relations must have the same set of attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top