exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 63 discussion

Actual exam question from Salesforce's CRT-450
Question #: 63
Topic #: 1
[All CRT-450 Questions]

Which SOQL query successfully returns the Accounts grouped by name?

  • A. SELECT Type, Max(CreatedDate) FROM Account GROUP BY Name
  • B. SELECT Name, Max(CreatedDate) FROM Account GROUP BY Name
  • C. SELECT Id, Type, Max(CreatedDate) FROM Account GROUP BY Name
  • D. SELECT Type, Name, Max(CreatedDate) FROM Account GROUP BY Name LIMIT 5
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
noox
Highly Voted 10 months, 3 weeks ago
Selected Answer: B
Why D is not correct ? It's because : "If the list of fields in a SELECT clause includes an aggregate function, you must include all non-aggregated fields in the GROUP BY clause." For the answer D to be correct, tou have to add ', Type' after GROUP BY Name, like this : SELECT Type, Name, Max(CreatedDate)MaxDate FROM Account GROUP BY Name, Type LIMIT 5 Source : https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_groupby.htm
upvoted 5 times
...
HR444
Most Recent 1 year, 3 months ago
Examples: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_groupby.htm
upvoted 2 times
...
am1
2 years, 6 months ago
B, because the field that we are using for Group by clause can be used in select. (no other field)
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...