Activity › Forums › Salesforce® Discussions › In Salesforce, How will you differentiate DML and SOQL?
Tagged: DML Operations, Salesforce Query, SOQL
-
In Salesforce, How will you differentiate DML and SOQL?
Posted by Mohit on September 19, 2016 at 2:38 PMHi All,
How is DML different from the SOQL?
Please give suggestion.
shariq replied 8 years, 10 months ago 3 Members · 2 Replies -
2 Replies
-
Hello Mohit,
SOQL(Salesforce Object Query Language) is the query language that allows you to retrieve data from the database.
for example-
Account a = [Select Name from Account where Name = ‘My Account’];
DML allows you to manipulate that data via inserts, updates etc.
for example-
Account a = new Account(Name = ‘New Account’);
insert a; // This will insert a account
a.Name = ‘Updated Name’;
update a;//Update the account record
Delete a;
//delete theaccount record
They relate to Apex in that they form part of the language. SOQL queries can be executed from Apex to retrieve information for further processing, DML allows Apex code to change the data.
- [adinserter block='9']
-
Hi Mohit,
SOQL :-
Salesforce Object Query Language is the language which is used to fetch data from salesforce database.
Example :- [SELECT Id FROM Opportunity LIMT 100]DML :-
Data Manipulation Language is the language which is used to Insert, Update or Delete data into/from database.
Example :-
Opportunity opp = new Opportunity(Name = ‘oppTest’, CloseDate = System.today(),StageName=’Prospecting’);
Insert opp;
Log In to reply.