QuestionQ40

VerifiedUsing the Set Operators

Examine the description of the COUNTRIES table:

Question Image

Examine the description of the DEPARTMENTS table:

Question Image

Examine the description of the LOCATIONS table:

Question Image

Which two queries return a list of countries that have no departments?

Choose two
Explanation

MINUS returns rows in its first result set that are absent from its second, so subtracting countries found through the LOCATIONS–DEPARTMENTS inner join leaves countries with no departments. Likewise, NOT IN excludes the country IDs produced by that same join. The subquery’s COUNTRY_ID is non-null because it comes from the COUNTRIES primary key, avoiding the null behavior that can invalidate a NOT IN predicate. INTERSECT instead retains countries with departments, and an inner join to DEPARTMENTS cannot yield a null DEPARTMENT_ID.

Learn more

Community Discussion

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