Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam CRT-450 topic 1 question 296 discussion

Actual exam question from Salesforce's CRT-450
Question #: 296
Topic #: 1
[All CRT-450 Questions]

A custom object Trainer__c has a lookup field to another custom object Gym__c.

Which SOQL query will get the record for the Viridian City Gym and all its trainers?

  • A. SELECT ID FROM Trainer__c WHERE Gym__r.Name = 'Viridian City Gym'
  • B. SELECT Id, (SELECT Id FROM Trainers__c) FROM Gym__c WHERE Name = 'Viridian City Gym'
  • C. SELECT Id, (SELECT Id FROM Trainer__c) FROM Gym__c WHERE Name = 'Viridian City Gym'
  • D. SELECT Id, (SELECT Id FROM Trainers__r) FROM Gym__c WHERE Name = 'Viridian City Gym'
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
83f117f
2 weeks ago
Selected Answer: C
It's D, object name is written in plural + __r that a custom object must have for a relationship query.
upvoted 1 times
...
SanjeevOnForce
6 months ago
DDDDDDDDDDDDDDDD
upvoted 1 times
...
irina_735
7 months, 3 weeks ago
Selected Answer: D
You need "get the record for the Viridian City Gym and all its trainers". But A answer returns all trainers without "record for the Viridian City Gym "
upvoted 3 times
...
wlthorn
1 year, 1 month ago
A. This query fetches all Trainer__c records where the related Gym__c record has a Name field equal to "Viridian City Gym". The "__r" notation is used to traverse the relationship from the Trainer__c object to the Gym__c object. "Gym__r.Name" is used to reference the Name field on the related Gym__c object.
upvoted 2 times
Envy_Pouki
8 months ago
Sorry but, based on how the question is written, I don't agree ... 'Which SOQL query will get the record for the Viridian City Gym and all its trainers?' It is asked to retrieve the record for the Viridian City Gym AND all its trainers. With A, you only get the trainers for the Gym and not the Gym record :)
upvoted 3 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...