This question runs in a pre-configured Salesforce environment - no personal connection required.

Query the Salesforce org for the top 5 Account records with the highest AnnualRevenue. Only include accounts where AnnualRevenue is not null. Return a list of the account Names ordered from highest to lowest revenue. If fewer than 5 accounts have revenue data, return all that do.

Examples:

Input: (no parameters - queries org data) Example with 6 accounts having revenue: Account 'Apex Corp' has AnnualRevenue = 5000000 Account 'Cloud Inc' has AnnualRevenue = 3000000 Account 'Data Systems' has AnnualRevenue = 2500000 Account 'Edge Tech' has AnnualRevenue = 1800000 Account 'Force Five' has AnnualRevenue = 1200000 Account 'Grid Solutions' has AnnualRevenue = 800000 Output: ['Apex Corp', 'Cloud Inc', 'Data Systems', 'Edge Tech', 'Force Five'] Explanation: Top 5 by revenue, Grid Solutions excluded as it falls outside the top 5 Example with fewer than 5 accounts having revenue: Output: All accounts with AnnualRevenue != null, ordered by revenue descending
Apex Code Editor

Welcome to Lightning Challenge!

Create an Account

Sign up to track your progress, earn points, and compete with others. Your solutions will be saved automatically.

Create account

How It Works

  • • Write your solution in the code editor
  • • Connect your Salesforce org to test
  • • Submit to check if your solution passes
  • • Use hints if you get stuck

Contest Alert

🏆 #CodeEveryDay June 2026

Contest runs June 1 - 30. Complete challenges to climb the leaderboard!

Only the 30 daily challenges shown during this contest count toward points. Earlier dailies don't carry over.

Wally can't hear you

Please sign in to access the AI Assistant

Sign In