Activity Forums Salesforce® Discussions What is the difference between SOQL and SOSL in Salesforce?

  • shariq

    Member
    September 22, 2018 at 11:00 am

    The differences are mentioned in the table below:

    SOQL vs SOSL

    SOQL (Salesforce Object Query Language)

    Only one object can be searched at a time

    Can query any type of field

    Can be used in classes and triggers

    DML Operation can be performed on query results

    Returns records

    SOSL (Salesforce Object Search Language)

    Many objects can be searched at a time

    Can query only on email, text or phone

    Can be used in classes, but not triggers

    DML Operation cannot be performed on search results

    Returns fields

  • Parul

    Member
    September 22, 2018 at 12:52 pm

    SOQL:
    1) SOQL (Salesforce Object Query Language ) retrieves the records from the database by using “SELECT” keyword.
    2) By Using SOQL we can know in Which objects or fields the data resides.
    3) We can retrieve data from single object or from multiple objects that are related to each other.
    4) We can Query on only one table.

    SOSL:
    1) SOSL(Salesforce Object Search Language) retrieves the records from the database by using the “FIND” keyword.
    2) By using SOSL, we don’t know in which object or field the data resides.
    3) We can retrieve multiple objects and field values efficiently when the objects may or may not be related to each other.
    4) We can query on multiple tables.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos