What Is SOQL in Salesforce?

SOQL (Salesforce Object Query Language) is the query language used to read records from Salesforce objects. It resembles SQL's SELECT statement but traverses

Updated 2026-09-09

SOQL (Salesforce Object Query Language) is the query language used to read records from Salesforce objects. It resembles SQL's SELECT statement but traverses relationships instead of joining tables.

In more detail

A SOQL query always names its fields explicitly - there is no SELECT *. It runs against one primary object and reaches related records through relationship names rather than JOIN syntax.

SOQL respects the running user's sharing rules and field-level security in user-mode contexts, so two users can run the same query and get different results.

A typical SOQL query
SELECT Id, Name, Industry, Owner.Name
FROM Account
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
LIMIT 50

Why it matters for admins

  • It is the fastest way to answer a data question without building a report.
  • Every data operation - export, cleanup, mass update - starts with a query that defines the scope.
  • Query selectivity determines whether an operation completes or times out on a large object.

Frequently asked questions

How is SOQL different from SQL?
SOQL has no JOIN, no SELECT *, and no ability to query across unrelated objects. It queries one object and traverses defined relationships, and it enforces the platform's sharing model.
What is the difference between SOQL and SOSL?
SOQL queries one object precisely. SOSL searches text across multiple objects at once, which makes it the right tool when you know the value but not the object.

More from the Glossary

Related reading