QuestionQ168

VerifiedUsing the SET Operators

View the Exhibit and review the structure of the CUSTOMERS and CUST_HISTORY tables.

Question Image

The CUSTOMERS table holds the current location of all active customers. The CUST_HISTORY table holds historical details for any location changes of current customers and former customers who are no longer active with the company.

You need to identify customers who have never changed their address. Which SET operator would you use to produce the required output?

Explanation

MINUS returns the rows from the first query that do not occur in the second query. Subtracting the customer IDs recorded in CUST_HISTORY from the customer IDs in CUSTOMERS returns active customers with no recorded location change.

Community Discussion

No comments yet. Be the first to start the discussion!