Use the Salesforce Object Query Language (SOQL) to search your
organization’s Salesforce data for
specific information. SOQL is similar to the SELECT statement in the widely used Structured
Query Language (SQL) but is designed specifically for Salesforce data.
With SOQL, you can construct simple but powerful query strings in the following environments:
- In the queryString
parameter in the query()
- In Apex statements
- In Visualforce controllers and
- In the Schema Explorer of the Force.com IDE
Similar to the SELECT command in Structured Query Language (SQL), SOQL allows you to specify the source
object (such as Account), a list of fields to retrieve, and conditions for selecting rows in the source object.
the SELECT statement combined with filtering statements to return sets of data, which can
optionally be ordered:
SELECT one or more fields
FROM an object
WHERE filter statements and, optionally, results are ordered
For example, the following SOQL
query returns the value of the Id
all Account records if the value of Name
SELECT Id, Name
WHERE Name = 'Sandy'