Relational Algebra
Set Operations
Union, intersection, and difference operate only on same-schema relations.
Set operations need matching schemas
Union, intersection, and difference combine whole row sets. They require identical column names in identical order. Note: the validator rejects incompatible schemas instead of guessing.
Union, intersect, difference
Here the recomputed union row count is 3, the intersect row count is 1, and the difference row count is 1. Note: every row shown comes from same-schema set algebra.
set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims
Difference is not symmetric
Reversing the operands changes which row remains. The recomputed reverse difference row count is 1. Note: A minus B asks a different question from B minus A.
set algebra not SQL bag/NULL, tiny finite tables, no product/perf claims
Summary
Set operations compare complete rows under matching schemas, and difference depends on operand order. Note: SQL duplicate-preserving variants and NULL behavior are deferred to the next book.