If the key word ALL is not used, then the duplicate strings should be automatically canceled during fulfillment of the operation. If ALL is indicated, then the number of duplicate rows is subject to the following rules (n1 – the number of duplicate rows of the first query, n2 – the number of duplicate rows of the second query):
INTERSECT ALL: min(n1, n2)
EXCEPT ALL: n1 - n2, if n1>n2.
Example 5.7.3
Select the ships, which are included both into Ships table and into Outcomes table.
In relational algebra intersection operation is commutative, as it is applied to relationships with identical titles. In SQL we can also change the order of the queries. The above-cited solution will give the same result as the following: