Top Three Pipeline Deals

Basic

The weekly forecast call opens with the three biggest deals in the pipeline.

Return Name and Amount of the three Opportunities with the largest Amount, largest first.

Sample data

Opportunity 5 records

NameStageNameAmountCloseDate
Atlas renewalProspecting75,000today + 30 days
Beacon pilotQualification20,000today + 30 days
Cobalt rolloutNegotiation/Review120,000today + 30 days
Delta expansionQualification51,000today + 30 days
Ember upgradeProspecting98,000today + 30 days

Expected result on the sample

NameAmount
Cobalt rollout120,000
Ember upgrade98,000
Atlas renewal75,000

Row order matters for this problem. Only the columns above are compared; extra columns in your SELECT are fine.

Hints
  • Sort descending with ORDER BY Amount DESC.
  • LIMIT 3 keeps the first three rows after sorting.

What this tests

ORDER BY with LIMIT is how you ask the database for "top N" instead of fetching everything and sorting in Apex, which wastes query rows and heap. The direction matters: ascending is the default, so a "largest first" list needs DESC.

SOQL

Run on sample executes your query against the sample data shown on the left and displays the rows it returns. Submit checks it against the sample plus 2 hidden datasets, comparing your rows with the expected rows on each. Queries run in a real Salesforce org; the data is inserted for your run and rolled back afterwards.