Understand SOQL Queries

To query data, create a SOQL statement that defines the information you want to search for. SOQL is a query language that’s similar to SQL but designed for Salesforce data.

The basic structure of a SOQL statement resembles this example.

For example, this SOQL query returns the value of the Id, FirstName, LastName, and Country fields for all contacts where the value of the MailingCountry field is NG. Results are returned in ascending order by LastName, and then in ascending order by FirstName. The maximum number of results returned is 25.