TopicSOQL
Focus AreaSOQL Practice
Questions30+
Topics3
Salesforce SOQL interview questions and practice queries collected from real developer interviews (updated Oct 2026). Covers basic queries, relationship queries, subqueries and aggregate and ranking queries so you can practise writing each one before the interview.
What's Covered
Topics covered in these questions.
01Basic SOQL Queries8
02Relationship & Subquery Queries10
03Aggregate & Ranking Queries12
All Interview Questions
Every question listed one by one, in a fresh order. Answers are not included, so practise explaining each one in your own words.
Basic SOQL Queries
1Find the average amount of all Closed Won Opportunities.
2Retrieve all Account names and their Industry.
3Retrieve Account names with their Opportunities where the Amount is greater than $50,000.
4Identify the five most recently created Leads.
5Find the total number of Opportunities for each Account.
6List the Opportunities that are due to close in the next 7 days.
7Fetch the latest 10 Account records.
8List all Closed Won Opportunities along with their amounts.
Relationship & Subquery Queries
9Write a query to fetch Contacts that are not associated with an Account.
10Fetch the active Account-related Contacts.
11Write a query to get Accounts that have more than three Contacts.
12Find Accounts created six months ago with no Contacts and no Opportunities.
13Write a parent-to-child query that returns Accounts with their Contacts.
14Retrieve names and emails of all Contacts associated with Opportunities in the Proposal stage.
15Write a query to get the role of a user, and the roles not assigned to any user.
16Retrieve the names of Contacts associated with an Opportunity named "XYZ Opportunity".
17Find Accounts that do not have any related Contacts.
18Write a SOQL query to get Accounts with at least one Contact.
Aggregate & Ranking Queries
19Find the highest, lowest, second highest and second lowest amount.
20What are the different clauses in SOQL, and what are the SOQL governor limits?
21Are you aware of dynamic SOQL? Write an example.
22Find the Account with the maximum number of Opportunities.
23What is the difference between SOQL and SOSL?
24Get the count of Opportunities by stage.
25What is the difference between a semi-join and an anti-join in SOQL?
26Find the Accounts that have exactly two Contacts.
27Find Contacts with the same name appearing more than twice.
28Write a query to find the nth highest amount Opportunity.
29Write a query to fetch the Account with the second highest Opportunity amount in a single query.
30Fetch the sum of the amounts of Opportunities, and the sum of all associated Opportunities within an Account.
Preparing for a Salesforce developer interview?
Browse more real company interview experiences and hands-on Apex trigger patterns.