Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Developer
easy

What is SOQL and how does it differ from SQL?

SOQL (Salesforce Object Query Language) is Salesforce's query language for retrieving records. Inspired by SQL but with key differences:

  • No `SELECT *` — you must list every field. Fields not selected return null on the resulting sObject.
  • Single-object queries with relationship traversalSELECT Id, Account.Name FROM Contact traverses the lookup, but classic SQL JOIN syntax doesn't exist. You use dot notation for parent and subqueries for children: SELECT Id, (SELECT Id FROM Contacts) FROM Account.
  • Limited operators — no UNION, no HAVING (use GROUP BY HAVING only), no full-text via LIKE (use SOSL for that).
  • Governor-limit aware — every query counts against the per-transaction SOQL limit (100 sync, 200 async).
  • Index-driven — for large tables, queries must hit indexed fields to be selective.
  • Polymorphic queries — query on Lookup-to-Polymorphic relationships (SELECT Id, What.Type FROM Task).

Use SOSL instead of SOQL for full-text search across multiple objects.

Why this answer works

Tests query fluency. The "no SELECT *, dot notation for parent, subquery for children" syntax is the most differentiated knowledge.

Follow-ups to expect

Related dictionary terms