Query:
SELECT NAME FROM SALESREPS WHERE REP_OFFICE NOT IN (SELECT OFFICE FROM OFFICES WHERE MGR = 108)
Function: “List the salespeople who do not work in offices managed by Larry Fitch (employee 108).”
Source: Groff, James R., and Paul N. Weinberg. LAN times Guide to SQL. Berkeley [u.a.: Osborne McGraw-Hill, 1994. Print. (p. 217)
Comments: This query illustrates the use of set membership (or non-membership) as a condition. The set in question is all the offices managed by the one whose identifying number is 108. The query result is a list of sales representatives who do not work in any of these offices. The query structure is simple and clear. What’s unclear–and somewhat disquieting–is the identity of this mysterious Larry Fitch … and the question of why we should want a list of sales representatives who are not managed by him. Has Mr. Fitch been implicated in some misconduct, some unethical or perhaps illegal activity? Churning? Embezzlement? Pump-and-dump? Or is he an especially troublesome manager, a martinet? Do we need to know who has not been psychologically damaged by his relentless reign of terror? The query leaves such questions unanswered, but I think it’s clear that Mr. Fitch is likely an especially loathsome fellow whom we should all endeavor to avoid. I would not answer his phone calls, texts, or e-mails, and if he should pass you in the hall, smile and nod politely, but do not engage in lengthy conversations … lest he pull you into his dark and twisted world of pain and wickedness.