# High-Value Tech Contacts with Account Owner

**Type:** SOQL · **Difficulty:** Hard · **Topics:** Parent Relationships, Multi-Level Traversal, NULLS LAST

Practice this problem interactively (write and run your SOQL against realistic data): https://www.forcechallenges.com/problems/high-value-tech-contacts-owner

## Problem

**Scenario**
The enterprise sales team is planning an outreach campaign to Contacts at its strongest technology customers. They want to know who these people are and which sales rep owns the relationship, so each rep can be briefed first.

**Task**
Write one SOQL query on `Contact` that returns Contacts whose parent Account meets all three conditions:
1. `Industry` is `Technology`.
2. `AnnualRevenue` is **greater than 5,000,000**.
3. `Rating` is `Hot` or `Warm`.

Sort the result by the Account's `AnnualRevenue` **highest first** (Accounts with no revenue last), then by Contact `Id` ascending so ties are stable. Return **at most 20** Contacts.

**Expected output**
One row per Contact with the columns `Id`, `Name`, `Account.Name` and `Account.Owner.Name`.

**Example**
- Contacts at Account A (Technology, revenue 9,000,000, Hot, owner Ada) come first.
- Contacts at Account B (Technology, revenue 7,000,000, Warm, owner Ben) come next.
- Contacts at Account C (Technology, revenue 8,000,000, Cold) are excluded because of the rating.
- Contacts at Account D (Finance, revenue 20,000,000, Hot) are excluded because of the industry.
- Only the first 20 matching Contacts are returned, even if more exist.

## Constraints

Use one query on Contact that filters and sorts through parent fields (Account.Industry, Account.AnnualRevenue, Account.Rating). Read the owner's name through two levels (Account.Owner.Name). Order by Account.AnnualRevenue DESC NULLS LAST, then Id ascending, and return at most 20 rows.

---
Source: ForceChallenges · last updated 2026-10-23
