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.
SELECT Id, Name, Industry, Owner.Name
FROM Account
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
LIMIT 50Why 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
- What Is a Salesforce ID in Salesforce?A Salesforce ID is the unique identifier of a record. It comes in a 15-character case-sensitive form and an 18-character case-insensitive form that is safe fo
- What Is an AI SOQL Builder in Salesforce?An AI SOQL builder turns a plain-English description of the records you want into a runnable SOQL query, using the schema of the org you are working in so the
- What Is a Change Set in Salesforce?A change set is Salesforce's built-in, point-and-click mechanism for moving configuration - not data - from one connected org to another, most commonly from a
- What Is a Duplicate Rule in Salesforce?A duplicate rule defines what Salesforce does when a user is about to save a record that looks like an existing one - block it, allow it with a warning, or ju
- What Is a Permission Set in Salesforce?A permission set is a collection of settings and permissions that extends a user's access without changing their profile. Permission sets are additive: they g
- What Is a Record Type in Salesforce?A record type lets one object behave differently for different business processes - different page layouts, different picklist values, and different default v
Related reading
- Admin How-ToHow to Write Salesforce Queries Without Knowing SOQL (AI SOQL)Describe the records you want in plain English and get a runnable SOQL query back - how AI SOQL builders work, what to check before you run the result, and where they still fall short.
- SOQL LibrarySOQL Query for the Latest Accounts (ORDER BY and LIMIT)Return the most recent accounts with ORDER BY and LIMIT, plus OFFSET paging and the null-ordering options most admins never touch.
- SOQL LibrarySOQL Query for the Latest Campaigns (ORDER BY and LIMIT)Return the most recent campaigns with ORDER BY and LIMIT, plus OFFSET paging and the null-ordering options most admins never touch.
- SOQL LibrarySOQL Query for the Latest Cases (ORDER BY and LIMIT)Return the most recent cases with ORDER BY and LIMIT, plus OFFSET paging and the null-ordering options most admins never touch.