Tag Archives: SOQL

How SOQL differs from SQL?

  • No INSERT, UPDATE or DELETE statements, only SELECT.
  • No command execution.
  • No wild cards for fields, all fields must be explicitly typed.
  • No JOIN statement. However, we can include information from parent objects like Select name, phone, account.name from contact.
  • No UNION operator.
  • Queries cannot be chained together.

How to query data which was modified in specific time limit in Salesforce?

Below is the SOQL to query data which was modified between 8 PM and 10 PM.

Sample SOQL:

SELECT Id, LastModifiedDate FROM Contact WHERE LastModifiedDate = TODAY AND HOUR_IN_DAY(LastModifiedDate) >= 20 AND HOUR_IN_DAY(LastModifiedDate) < 22