Salesforce Object Query Language(SOQL)

I will discuss some of the SOQL statement that helps you in development over force.com Apex.

SOQL is similar to the SELECT statement used in SQL but its specially designed for salesforce data.

Here I will discuss the below List of statements with an example

SOQL SELECT Syntax:

    Condition Expression Syntax (WHERE Clause)
    ORDER BY
    LIMIT

Lets start one by one

SOQL SELECT Syntax:

The SOQL SELECT statement uses the following syntax:

    SELECT FieldName FROM objectName

FieldName: Similar table Fileds
ObjectName: Similar SQL Database Table

Example:

SELECT ID,Name,AccountNumber FROM Account

Condition Expression Syntax (WHERE Clause):

    Syntax:SELECT FieldName FROM objectName [WHERE conditionExpression]
    SELECT ID,Name,AccountNumber FROM Account where Name='United Oil & Gas, SingaporeUpdated'

Order By:

Syntax:

    SELECT FieldName FROM objectName [ORDER BY fieldOrderByList {ASC|DESC} [NULLS {FIRST|LAST}] ]
    SELECT ID,Name,AccountNumber FROM Account order by Name asc

LIMIT:

Syntax:

    SELECT FieldName FROM objectName Limit 10
    SELECT ID,Name,AccountNumber FROM Account limit 10

I will share all other SOQL statement that will help you to start development on FORCE.COM.

Ebook Download
View all
Learn
View all