What is SOQL (Salesforce Object Query Language)?
Salesforce Object Query Language. It is used to retrieve data from Salesforce database according to the specified conditions and objects. Similar to all Apex code, SOQL is also case insensitive.
Use SOQL when you know which objects the data resides in, and you want to:
- Retrieve data from a single object or from multiple objects that are related to one another.
- Count the number of records which meet the specified criteria.
- Sort results as part of the query.
- Retrieve data from number, date, or checkbox fields.
A SOQL query is equivalent to a SELECT SQL statement and searches the org database.
Example:
Select name from account // standard object
Select name, Student_name from student__c // custom object
But we cannot use asterisk (*) in SOQL queries which we can use in sql.