Salesforce Certified Platform Developer I — Question 1

A custom object Trainer_c has a lookup field to another object Gym_c.
Which SOQL query will get the record for the Viridian Gym and all it’s trainers?

Answer options

Correct answer: D

Explanation

Option D is correct because it properly references the relationship using the correct child relationship name 'Trainers_r' to fetch trainers linked to the Gym_c record. Option A incorrectly uses 'Trainer_c' instead of the relationship name, while B uses 'Trainers_c' which is not the correct relationship name. Option C does not return the Gym_c record and instead queries only the Trainer_c records, making it incorrect for this requirement.