0:00 21:15

SOQL joins: relationships in queries

21:15Runtime IntermediateLevel Jan 2026Last updated

Two objects, one query. This lesson is the difference between walking up a relationship, which is free, and walking down it, which is not — and the rewrite that turns the second into the first.

00:12
A lookup field does not store the record. It stores an id, and the platform knows what that id points at — which is why you can walk it in a query instead of running a second one.
03:02
Dot notation goes up. Contact.Account.Name is one query, not two, and it is five levels deep before the platform stops you.
08:03
Going down is a subquery, and it is a different shape: you get the parent rows back with a list of children hanging off each one.
14:05
Here is the part that bites. The child rows count against the same 50,000, and they count whether or not you look at them.
18:10
So we take the query from the top of the lesson and turn it inside out — same answer, a tenth of the rows.
Notes are private, and they carry the timestamp so the note takes you back to the moment.

No questions on this chapter yet

Twelve on the lesson as a whole. Ask about the chapter you are in and it lands beside the timestamp.

Ask a question
Lesson 07 of 12 SOQL joins: relationships in queries
Apex fundamentals 6 / 12 done
SELECT and WHERE (completed) Video 14:02 SOQL joins: relationships Video 21:15 Aggregate queries Article 18:40 Check yourself Quiz 05:00 Build a selective query Lab 22:10 Bulk-safe triggers (locked — members only) Video
Resume