Valid CRT-450 Dumps shared by ExamDiscuss.com for Helping Passing CRT-450 Exam! ExamDiscuss.com now offer the newest CRT-450 exam dumps, the ExamDiscuss.com CRT-450 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com CRT-450 dumps with Test Engine here:
A custom object Trainer_ < has a lookup field to another custom object cym__ c. Which SOQL query will get the record for the Viridian City Gym and all it's trainers?
Correct Answer: A
Given that Trainer__c has a lookup field to Gym__c, to retrieve the record for the 'Viridian City Gym' and all its trainers, the correct SOQL query is: Option A: SELECT Id, (SELECT Id FROM Trainers__r) FROM Gym__c WHERE Name = 'Viridian City Gym' Parent-to-Child Query (Subquery): To retrieve child records (trainers) from the parent record (gym), you perform a subquery using the child relationship name. Child Relationship Name: For a lookup relationship, the child relationship name can be found in the relationship settings. By default, if the lookup field on Trainer__c is Gym__c, the child relationship name is Trainers__r. Query Breakdown: SELECT Id, (SELECT Id FROM Trainers__r) FROM Gym__c WHERE Name = 'Viridian City Gym' Selects the Gym record and all related Trainers. Why Other Options Are Incorrect: Option B: (SELECT Id FROM Trainer__c) Trainer__c is an object, not a relationship name, so the subquery is incorrect. Option C: SELECT ID FROM Trainer__c WHERE Gym__r.Name = 'Viridian City Gym' This query retrieves Trainer records, not the Gym record and its trainers as specified. Option D: (SELECT Id FROM Trainers__c) Trainers__c is incorrect; the child relationship name should end with __r in subqueries. Reference: SOQL Relationships and Subqueries: "To retrieve related child records, use a subquery in the SELECT clause." - Salesforce SOQL and SOSL Reference: Relationship Queries Conclusion: Option A correctly retrieves the Gym record and all its related Trainer records using a parent-to-child subquery.