Activity Forums Salesforce® Discussions In Salesforce, How will you differentiate DML and SOQL?

  • Tanu

    Member
    September 20, 2016 at 10:22 am

    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.

  • shariq

    Member
    July 21, 2017 at 11:59 am

    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.

Popular Salesforce Blogs

Popular Salesforce Videos