03 · SOQL: asking the database questions

Article lesson 25m 1 min read

SELECT is not SQL — no joins, no wildcards, relationship dots instead. Write your first twenty queries in the Query Editor.

Relationships replace joins

Contact.Account.Name walks up; (SELECT ... FROM Contacts) walks down. Once relationship queries click, you will stop missing joins.

Query in loops is the cardinal sin

One SOQL query per record is how orgs die at scale. We commit the rule to memory now, two lessons before triggers make it dangerous.

Practice in your org

  • Open your Developer Edition org and follow along step by step
  • Change one thing at a time and note what happens
  • When something breaks, read the error before searching for it