Development questions
Write a SOQL query to fetch all Accounts along with their related Contacts (Parent-to-Child).
Use a parent-to-child subquery with the child relationship name.
soql
SELECT Id, Name, (SELECT Id, FirstName, LastName FROM Contacts) FROM Account
Accounts with no Contacts are still returned (with an empty child list), unlike an inner join.
soqlscenarioparent-to-child
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?