SOQL means Salesforce Object Query Language which is to query the records from the database.com based on the requirement.  Salesforce Apex and SOQL (Salesforce Object Query Language) together give the developers powerful tools for managing Salesforce data and processes of their application.

  • Records are pertaining to single sObject.
  • Using Salesforce Object Query Language developers can fetch and process a large amount of data in an easy, human-readable query language.
  • Salesforce Object Query Language is very similar to SQL (Structured Query Language) used in other database systems.
  • It doesn’t support all advanced features of the SQL.

Learn Salesforce Apex – SOQL features & Limitations.

  1. Salesforce Object Query Language is case sensitive and very easy to understand.
  2. It is similar to SQL and helps to optimize code.
  3. It reduces workload time.
  4. Salesforce objects data can be retrieved or extracted into Excel sheets.
  5. It returns records.
  6. Records are stored in a collection.

Salesforce Apex: SOQL limitations

  1. By default, 20,000 characters for a Statement.
  2. The number of SOQL rows – 50k.
  3. The number of SOSL Queries – 20.
  4. The number of DML Statements – 150.
  5. The number of DML Rows – 10k.
  6. The number of Script Statements – 200k.
  7. Maximum Heap size – 3000k.
  8. The number of callout – 10.
  9. The number of Email invocation – 10.
  10. Number of Filed describes – 100.
  11. The number of Child relationships – 100.
  12. The number of picklists describes – 100.
  13. The number of future calls – 10.

Writing first SOQL Statement?

Salesforce Object data can be retrieved using SOQL queries. To execute Salesforce Object Query Language queries we must install Force.com explorer software in our local system. And also we can use Force.com IDE. It is a powerful client application used to create, modify, test and develop Force.com application.

  • Learn How to install Force.com Explorer.
  • How to install Force.com IDE.

SOQL example Statement.

As shown above, fetching Record Id and Name from Standard object Account. To fetch records from Custom objects we must use __c at the end of the custom Object name.

SOQL Example Statement.

From the above example, Student__c is the custom object and we fetching Record name and Subject1 marks details from Student object.

In this Salesforce Developer tutorial, we learn about enabling development mode in Salesforce, SOQL basics, SOQL Syntax, tools like Force.com Explorer and Force.com IDE, How to install Force.com Explorer, How to Install Force.com IDE,  basics, Syntax, and Statements. Salesforce Apex and SOQL together give the developers powerful tools for managing the data and processes of their application.

Learn SOQL (Salesforce Object Query Language) – APEX Tutorials.

soql - Salesforce object query language

Salesforce Developer Tutorials – SOQL Basics

  1. How to Enable Developing Mode in Salesforce?
  2. Overview About developer Console.
  3. SOQL Syntax and Classes.
  4. How to write First SOQL Statement in Force.com Explorer?
  5. How to know API names for Objects and Field?

Basic Statements

[su_row][su_column size=”1/2″]

  1. The Alias Notation.
  2. The WHERE Clause.
  3. IN Operator.
  4. ORDER BY clause.
  5. INCLUDES and EXCLUDES operators.

[/su_column]

[su_column size=”1/2″]

  1. Comparison Operators.
    • Equals.
    • Not Equals.
    • Less Than.
    • Less Than or Equal to.
    • Greater than.
    • Greater than or equal to.
    • Like.

[/su_column] [/su_row]

 Advanced statements.

[su_row][su_column size=”1/2″]

  1. SOQL Relationships.
    • Relationships between Standard Objects.
    • Relationships between Custom Objects.
    • Many-to-One Relationships (n:1) in SOQL.
    • Semi-Join and Anti Join.
    • Inner Join and Outer Join.

[/su_column]

[su_column size=”1/2″]

  1. Filtering Multi Select picklist values.
  2. Escape Sequence.
  3. Date Formats
  4. Date literals.
  5. GROUP BY ROLLUP Clause.
  6. FOR REFERENCE Clause.
  7. FOR VIEW Clause

[su_row][su_column size=”1/2″]

SOQL Functions

  1. GROUP BY Class.
    1. COUNT ( ).
    2. COUNT (FIELD _NAME).
    3. COUNT_DISTINCT ( ).
    4. SUM ( ).
    5. MIN ( )
    6. MAX ( ).
  2. HAVING Class.