SALESFORCE-PD1 Developer Fundamentals Practice Question
A developer needs to retrieve a list of Accounts along with their related Contacts using a single SOQL query in Apex. Which query structure is syntactically correct?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account
Parent-to-child relationships in SOQL are queried using a subquery within parentheses inside the SELECT clause.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
SELECT Id, Name, Contacts.Id, Contacts.LastName FROM Account
Why it's wrong here
Child relationships cannot be dotted directly in the SELECT clause of the parent object; a subquery is required.
- ✗
SELECT Id, Name, Contact__r.Name FROM Account
Why it's wrong here
This syntax represents a child-to-parent relationship (many-to-one), not a parent-to-child relationship.
- ✗
SELECT Id, Name, (SELECT Id, LastName FROM Contact) FROM Account
Why it's wrong here
The plural relationship name (e.g., Contacts) must be used in the subquery, not the object name.
- ✓
SELECT Id, Name, (SELECT Id, LastName FROM Contacts) FROM Account
Why this is correct
This represents a valid parent-to-child relationship query using a subquery for the child relationship name.
About these practice questions
This SALESFORCE-PD1 question is part of Courseiva's 488-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed August 2026 · checked against the official Salesforce exam blueprint
This SALESFORCE-PD1 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SALESFORCE-PD1 exam.