Which three data types can be returned from an SOQL statement? (Choose three.)
Which three data types can be returned from an SOQL statement? (Choose three.)
SOQL (Salesforce Object Query Language) statements can return three different types of data: lists of sObjects, single sObjects, and integers. Specifically, a list of sObjects is returned when a query is executed that matches multiple records. A single sObject can be returned when the query matches exactly one record. An integer can be returned when aggregate functions such as COUNT() are used in the query.
SOQL statements evaluate a list of sObjects, a single sObject, or an Integer for count method queries.
Types Of SOQL Return Type Lists<sObject> sObject. Integar. AggregateResult.
List of sObjects: List<Account> accounts = [SELECT Id, Name FROM Account LIMIT 10]; Single sObject: Account acc = [SELECT Id, Name FROM Account WHERE Id = '001XXXXXXXXXXXX']; String: String accountName = [SELECT Name FROM Account WHERE Id = '001XXXXXXXXXXXX'].Name; These examples demonstrate how SOQL queries can return either a list of sObjects, a single sObject, or a field value as a String.
In the last scenario the SOQL is returning an object, you're just assigning a field from this object to a variable, and in that case, any other type would be considered a correct answer here. The correct answer is BCD, because a SOQL can return an Integer in case of a COUNT method query.