OFFSET in Salesforce (SOQL)

In this blog, I will explain OFFSET, which is used for paging concept as well as large result set. OFFSET is more efficient than retrieving the full result set and then filtering the results locally.

Thank you all the readers who read my last two blogs regarding Salesforce Object Query Language (SOQL). 
You guys motivated me to write some other stubs that will help you to develop apex force.com based application.Today I will discuss OFFSET
 
OFFSET is an efficient way to handle large results sets. OFFSET is more efficient than retrieving the full result set and then filtering the results locally
 
Example:
 
OFFSET to display records 10 to 50 and then jump to display records 51 to 100.
 
Let's create some SOQL query and test in SOQL Editor.
 
SELECT ID, Name, AccountNumber FROM Account limit 20  
 
The above query returns 19 records. Here is the screenshot:

records

Let's use OFFSET, here's an example:
 
SELECT ID, Name, AccountNumber FROM Account limit 20 OFFSET 5 
 
The above query returns 14 records and skips 5 records to help you in doing paging. Here is the screenshot:

image
 
I will share other SOQL statements that will help you to start development on FORCE.COM.