Finding Common Rows with INTERSECT
An INTERSECT operation combines the results of two queries into a single result that comprises all the rows common to both queries. Intersections have the same restrictions as unions; see “Combining Rows with UNION” earlier in this chapter.
To find common rows:
select_statement1 and select_statement2 are SELECT statements. The number and the order of the columns must be identical in both statements, and the data types of corresponding columns must be compatible. Duplicate rows are eliminated from the result.
Listing 7.46 uses INTERSECT to list the cities in which both an author and a publisher are located. See Figure 7.46 for the result.
Listing 7.46. ...