CRT-450 Exam QuestionsBrowse all questions from this exam

CRT-450 Exam - Question 86


Which three data types can be returned from an SOQL statement? (Choose three.)

Show Answer
Correct Answer: BCD

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.

Discussion

3 comments
Sign in to comment
tanyenOptions: BCD
Apr 8, 2024

SOQL statements evaluate a list of sObjects, a single sObject, or an Integer for count method queries.

helper_rawOptions: BCD
May 23, 2024

Types Of SOQL Return Type Lists<sObject> sObject. Integar. AggregateResult.

ABHI0O07
Sep 21, 2024

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.

MaxGoiabinha
Oct 20, 2024

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.