What are the DML statements available in Apex?
Governor Limits for DML statements ?
Difference between insert/update and Database.insert/ Database.update?
Q. What is a SOQL (SALESFORCE OBJECT QUERY LANGUAGE)?
Answer:
The Salesforce Object Query Language (SOQL) to construct simple but powerful query strings to select records from salesforce objects. Similar to the SELECT command in Structured Query Language (SQL), SOQL allows you to specify the source object (such as Account), a list of fields to retrieve, and conditions for selecting rows in the source object.
For example, the following SOQL query returns the value of the Id and Name field for all Account records if the value of Name is Sandy:
SELECT Id, Name FROM Account WHERE Name = 'Sandy'
There is a Queue with name MyQueue. How to query it using SOQL query from the database?
Q. What is a SOSL (SALESFORCE OBJECT SEARCH LANGUAGE)?
Answer:Salesforce Object Search Language (SOSL) to construct simple but powerful text searches for the Search() call. Unlike SOQL, which can only query one object at a time, SOSL allows you to efficiently search text, email, and phone fields for multiple objects at a time with a single query.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.Answer:
Description Limits Total number of SOQL queries issued 100 Total number of SOQL queries issued for Batch Apex and future methods 200 Total number of records retrieved by SOQL queries 50,000 Total number of records retrieved by Database.getQueryLocator 10,000 Total number of SOSL queries issued 20 Total number of records retrieved by a single SOSL query 200Question: What are the diff bt SOQL and SOSL in SALESFORCE?Answer:
SOQL SOSL It’s a Salesforce Object Query Language. It’s a Salesforce Object Search Language. Search in Single Object. Search in Entire Organization or Data base. Returns Records. Returns Fields. It can use in Triggers. It can use in Triggers. Changed
No comments:
Post a Comment