Important SOQL Query For Interview
- Abhilash Banpurkar
- Oct 27, 2022
- 1 min read
Write SOQL Query to Retrieve First 10 records of Account.
Select id,name from Account limit 10
2.Write a SOQL Query to retrive 10 latest records from Lead objects.
Select id,Name,Status from Lead order By CreatedDate DESC limit 10
3.What is the Maximum Value of Offset we Can set.
2000
4.Write a Syntax to Fetch the Records From Recycle bin.
Select id, isDeleted from <Sobject name> where isDeleted =true all rows
5.Write a SOQL Query to Retrive records of Todays date from Lead object.
Select id,Name,Status,Company,CreatedDate from Lead Where CreatedDate=Today
6.Find Second highest amount opportunity using SOQL.
Select amount from opportunity order By Amount DESC limit 1 offset 1
7.Write SOQL Query to Get Related contacts from the Account.
Select Name,Phone,Industry,Rating(Select Name,Phone,Company From Contacts)
from Account.
8.Count individual balance from contact group by name having count of individual balance greater than 1000.
Select Count(Individual_balance__c),Name from Contact group by name having count(individual_balance__c)>1000.
9.Count number of Unique stage name from Opportunities.
Select Count_distinct(StageName) from opportunity
10.Retrive all the contact records where name contains 's'.
Select name,id from contact where name like '%s'
Comments