When does we use SOQL and SOSL in SALESFORCE?

Q.When does we use SOQL and SOSL in SALESFORCE?

Answer:
SOQL:
1. You know in which objects or fields the data resides.
2. You want to retrieve data from a single object or from multiple objects that are related to one another.
3. You want to retrieve data from number, date, or checkbox fields.
4. You want to count the number of records that meet specified criteria.
5. You want to sort results as part of the query.

SOSL:
1. You don't know in which object or field the data resides and you want to find it in the most efficient way possible.
2. You want to retrieve multiple objects and fields efficiently, and the objects may or may not be related to one another.
3. You want to retrieve data for a particular division in an organization using the divisions feature, and you want to find it in the most efficient way possible.

BOTH SOQL OR SOSL:
1. Both SOSL and SOQL WHERE filters can specify text to look for. When a given search can use either language, SOSL is generally faster than SOQL if the search expression uses leading wildcards or a CONTAINS term.
2. In some cases, when multiple WHERE filters are being used in SOQL, indexes cannot be used even though the fields in the WHERE clause may be indexed. In this situation, decompose the single query into multiple queries each with one WHERE filter and then combine the results.
3. Executing a query with a null in a WHERE filter makes it impossible to use indexing. Such queries must scan the entire database to find appropriate records. Design the data model not to rely on nulls as valid field values.
4. If dynamic values are being used for the WHERE field and null values can be passed in, don’t let the query run to determine there are no records; instead check for the nulls and avoid the query if necessary.

COMMENTS

BLOGGER
Name

Apex Apex Default Methods Apex Methods Apex_Collections Apps Batch Apex Books CRM eBooks Data Import Wizard Data Management DataLoader Dataloader.io Difference Between Error in Salesforce FAQ's FAQ's-Apex FAQ's-Apps FAQ's-CRM FAQ's-Data loader FAQ's-SOQL & SOSL FAQ'S-Triggers FAQ's-User Profile & Security FAQ's-VF Force.com Explorer Force.com Ide Formulas & Functions Integration Interview Questions Only Latest_Updates Limits&Best Practices Online-Training Reports and Dashboards Salesforce Deployment Salesforce Realtime Examples On Development Salesforce Realtime Task On Admin Salesforce Realtime Tasks Salesforce Realtime Tasks- Apex Salesforce Training Salesforce1 Mobile Sites SOQL Spring'14 Release Triggers User Profile & Security VF Tags VisualForce Winter'14 Release Wizard for Accounts/Contacts Workbench Workflows and Approvals
false
ltr
item
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners: When does we use SOQL and SOSL in SALESFORCE?
When does we use SOQL and SOSL in SALESFORCE?
When Does We Use Soql And Sosl In Salesforce?,When Does We Use Soql,When Does We Use SoSl,soql user record access,what is the use of soql,what is the use of sosl
Sfdc Gurukul- All in one place for salesforce and force.com step by step tutorial for beginners
http://sfdcgurukul.blogspot.com/2013/10/when-does-we-use-soql-and-sosl-in.html
http://sfdcgurukul.blogspot.com/
http://sfdcgurukul.blogspot.com/
http://sfdcgurukul.blogspot.com/2013/10/when-does-we-use-soql-and-sosl-in.html
true
4199533888133360731
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy