Salesforce
PDII · Question #238
A developer has a requirement to query three fields (Id, Name, Type) from an Account and First and Last names for all Contacts associated with the Account. Which option is the preferred optimized…
The correct answer is B. Account a = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts) FROM. See the full explanation below for the reasoning.
Question
A developer has a requirement to query three fields (Id, Name, Type) from an Account and First and Last names for all Contacts associated with the Account. Which option is the preferred optimized method to achieve this for the Account named 'Ozone Electronics'?
Options
- AAccount a = [SELECT ID, Name, Type FROM Account WHERE name='Ozone Electronics']; list
- BAccount a = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts) FROM
- Clist lContacts = new list();
- Dlist lAccounts = [SELECT ID, Name, Type FROM Account JOIN (SELECT ID, firstname, lastname
How the community answered
(32 responses)- A6% (2)
- B81% (26)
- C9% (3)
- D3% (1)
Community Discussion
No community discussion yet for this question.