Scenario The sales team is hunting for white space: customers and prospects that nobody has sold to yet. Before planning outreach, they want a clean list of Accounts that have never had any Opportunity created, whatever its stage.
Task
Write one SOQL query on Account that returns every Account that has no Opportunities at all. An Account that has only closed, lost or old Opportunities still counts as having Opportunities and must not be returned.
Note that your data may also contain Opportunities that are not linked to any Account. They do not affect which Accounts qualify.
Expected output
One row per Account with two columns: Id and Name. Row order is not checked.
Example
Result: Initech and Umbrella (each with its Id and Name).
Return exactly Id and Name. Use an anti-join (WHERE Id NOT IN (SELECT AccountId FROM Opportunity)). Row order is not checked.
20 row(s), any order
| # | Id | Name |
|---|---|---|
| 1 | 001000000000002AAA | Prospect 2 |
| 2 | 001000000000004AAA | Prospect 4 |
| 3 | 001000000000006AAA | Prospect 6 |
| 4 | 001000000000008AAA | Prospect 8 |
| 5 | 001000000000010AAA | Prospect 10 |
| 6 | 001000000000012AAA | Prospect 12 |
| 7 | 001000000000014AAA | Prospect 14 |
| 8 | 001000000000016AAA | Prospect 16 |
| 9 | 001000000000018AAA | Prospect 18 |
| 10 | 001000000000020AAA | Prospect 20 |
| 11 | 001000000000022AAA | Prospect 22 |
| 12 | 001000000000024AAA | Prospect 24 |
| 13 | 001000000000026AAA | Prospect 26 |
| 14 | 001000000000028AAA | Prospect 28 |
| 15 | 001000000000030AAA | Prospect 30 |
| 16 | 001000000000032AAA | Prospect 32 |
| 17 | 001000000000034AAA | Prospect 34 |
| 18 | 001000000000036AAA | Prospect 36 |
| 19 | 001000000000038AAA | Prospect 38 |
| 20 | 001000000000040AAA | Prospect 40 |