0% found this document useful (0 votes)
24 views

Soql

This summary provides the key information from the document in 3 sentences: The document discusses SOQL keywords and syntax for field lists, subqueries, and aggregate functions used in SOQL queries. It also covers relationship queries and limits for SOQL including the number of queries allowed, records retrieved, and DML statements. The document also includes information on synchronous and asynchronous limits for Apex including heap size, CPU time, and future calls.

Uploaded by

ruturajb60
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Soql

This summary provides the key information from the document in 3 sentences: The document discusses SOQL keywords and syntax for field lists, subqueries, and aggregate functions used in SOQL queries. It also covers relationship queries and limits for SOQL including the number of queries allowed, records retrieved, and DML statements. The document also includes information on synchronous and asynchronous limits for Apex including heap size, CPU time, and future calls.

Uploaded by

ruturajb60
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SOQL keywords :AND, ASC, DESC, EXCLUDES, FIRST, FROM, GROUP, HAVING, IN, INCLUDES,

LAST, LIKE, LIMIT, NOT, NULL, NULLS, OR, SELECT, USING, WHERE, WITH .

fieldList subquery
Specifies a list of one or more fields, separated by commas, that you want to
retrieve from the specified object. The bold elements in the following examples are
fieldlist values:
SELECT Id, Name, BillingCity FROM Account
SELECT count() FROM Contact
SELECT Contact.Firstname, Contact.Account.Name FROM Contact
SELECT FIELDS(STANDARD) FROM Contact

typeOfField
whenExpression
elseExpression
objectType
filterScope
conditionExpression
In SOQL, if you use OFFSET and LIMIT in your SOQL query, the number of records
returned can be less than LIMIT

Aggregate Functions:
Use aggregate functions in a GROUP BY clause in SOQL queries to generate reports
for analysis.
Aggregate functions include AVG(), COUNT(), MIN(), MAX(), SUM(),
COUNT(fieldName),COUNT(Id)and more.
COUNT_DISTINCT() :Returns the number of distinct non-null field values matching the
query criteria
SELECT COUNT_DISTINCT(Company) FROM Lead

CALENDAR_MONTH(),CALENDAR_QUARTER(),CALENDAR_YEAR(),DAY_IN_MONTH(),DAY_IN_WEEK(),DA
Y_IN_YEAR(),DAY_ONLY(),FISCAL_MONTH(),FISCAL_QUARTER(),FISCAL_YEAR(),
HOUR_IN_DAY(),WEEK_IN_MONTH(),WEEK_IN_YEAR()
SELECT CALENDAR_YEAR(CreatedDate), SUM(Amount)
FROM Opportunity
GROUP BY CALENDAR_YEAR(CreatedDate)
use the CALENDAR_YEAR() function to find the sum of the Amount values for all your
opportunities for each calendar year.
===================================================================================
===================================================
Relationshp quries :
--------------------
select contact.firstname,contact.account.name from contact

This query returns the first names of all the contacts in the organization, and for
each contact, the account name associated with (parent of) that contact

You can't use a LIMIT clause in a query that uses an aggregate function, but does
not use a GROUP BY clause

the maximum number of Bulk Apex jobs added to the queue with System.enqueueJob is
the synchronous limit (50), which is higher than the asynchronous limit (1).
Description Synchronous Limit Asynchronous Limit
Total number of SOQL queries issued1 100 200
Total number of records retrieved by SOQL queries 50,000 50,000
Total number of records retrieved by Database.getQueryLocator 10,000 10,000
Total number of SOSL queries issued 20 20
Total number of records retrieved by a single SOSL query 2,000 2,000
Total number of DML statements issued2 150 150
Total number of records processed as a result of DML statements, Approval.process,
or database.emptyRecycleBin 10,000 10,000
Total stack depth for any Apex invocation that recursively fires triggers due to
insert, update, or delete statements3 16 16
Total number of callouts (HTTP requests or web services calls) in a transaction
100 100
Maximum cumulative timeout for all callouts (HTTP requests or Web services calls)
in a transaction 120 seconds 120 seconds
Maximum number of methods with the future annotation allowed per Apex invocation
50 0 in batch and future contexts; 50 in queueable context
Maximum number of Apex jobs added to the queue with System.enqueueJob 50 1
Total number of sendEmail methods allowed 10 10
Total heap size4 6 MB 12 MB
Maximum CPU time on the Salesforce servers5 10,000 milliseconds 60,000
milliseconds
Maximum execution time for each Apex transaction 10 minutes 10 minutes
Maximum number of push notification method calls allowed per Apex transaction
10 10
Maximum number of push notifications that can be sent in each push notification
method call 2,000 2,000
Maximum number of EventBus.publish calls for platform events configured to publish
immediately 150 150

You might also like