What will this projection be?
In relational algebra, your difference in settings will lead to an error because the two sets are not compatible with each other:
To unite a union and a difference in a set, two interrelated relationships must be union compatible, i.e. the two relationships must have the same set of attributes. from wikipedia
In SQL, the setting difference will work because join compatibility is understood more leniently, that is, set degrees and data types must match, but not names. So this is really SQL:
SELECT X FROM A
EXCEPT
SELECT Z FROM A
The result will be a table with one column named X
However, even in SQL, you cannot project Y
from a given difference, so π Yimpossible, neither in SQL nor in relational algebra. This will be invalid SQL:
SELECT Y -- Y is not defined here, only X
FROM (
SELECT X FROM A
EXCEPT
SELECT Z FROM A
)
source to share