(Contents)(Previous)(Next)

INTERSECT

A subset relation can be established using the statement INTERSECT.

All cities are to be found that occur in the table 'customer' as well as in the table 'hotel'. Without the additional specification of ALL, an implicit DISTINCT is issued again.

SELECT city

FROM customer

WHERE zip < 50000

INTERSECT

SELECT city

FROM hotel

WHERE zip < 50000

Values repeatedly occurring in the subset are displayed by using the following statement. The result values only occur as often as the values from the two tables 'customer' and 'hotel' have a counterpart in the corresponding other table.

SELECT city

FROM customer

WHERE zip < 50000

INTERSECT ALL

SELECT city

FROM hotel

WHERE zip < 50000


(Contents)(Previous)(Next)