Hi Guys..
I came up with today's topic..
About SOQL
SOQL Stands of Salesforce object query language, Using SOQL we will retrieve the data from Single object and their related objects. SOQL are similar to SQL queries but it is designed
specifically for Salesforce.
Syntax of SOQL:
Select field1,field2,field3----- from object
Our list will return the list data and it's in order format.
If we want we can add the conditions to your Select query.
Syntax:
Single where Condition
Select field1,field2,field3----- from
object where Condition1
select id,Name,Phone from Account
Multiple conditions:
Select field1,field2,field3----- from
object where Condition1 AND Condition 2-----etc
Select id,Name,Phone from Account where
Name=’IBM’ AND Name = ‘CSC’
Like Operator:
Using of
this like operator we will match the key value.
Ex:
Select field1,field2,field3----- from
object where Field LIKE ‘%key%’
Select id,Name,Phone from Account
where Name LIKE ‘%IBM%’
In the Name wherever
it find the IBM text it will fetch all the value.
Sorting:
Ascending order:
We can sort the SOQL result in Ascending order.
Ex: Select field1,field2,field3----- from
object Order BY Field asc
Select id,Name,Phone from Account Order
BY Name asc;
Descending order:
We can sort the SOQL result in Descending order.
Ex: Select field1,field2,field3----- from
object Order BY Field desc
Select id,Name,Phone from Account Order
BY Name desc;
Limit:
Using of limit statement we will limit the Values
Ex: Select field1, field2, field3----- from object limit 5
In the above
query we will retrieve 5 Records from the object.
Select id, Name, Phone from Account
limit 5;
In the above
query we will retrieve 5 Records from the object.
Count ();
Using of the
count method we will calculate the number of values return in the query.
EX: Select Count
() from object
you are doing good job and its very useful to me thank you somuch brother
ReplyDeleteThank you Dileep.. Everyday we will post one concept from Salesforce.
ReplyDelete