Development questions
Write a SOQL query to find all Contacts whose LastName starts with 'S' and ends with 'a'.
Use LIKE with a prefix and suffix pattern. % matches any number of characters, _ matches exactly one.
soql
SELECT Id, FirstName, LastName FROM Contact WHERE LastName LIKE 'S%a'
Note that LIKE in SOQL is case-insensitive, and a leading wildcard (like %a) alone would make the query non-selective.
soqlscenariolike
More Development questions
- What is an Apex Trigger in Salesforce and when should you use it over Flows?
- What is the difference between before triggers and after triggers?
- Explain all Trigger context variables (isInsert, isUpdate, isDelete, isUndelete, isBefore, isAfter, isExecuting, size, operationType).
- What is the difference between Trigger.new and Trigger.old?
- In which trigger events are Trigger.new and Trigger.newMap available?
- In which trigger events are Trigger.old and Trigger.oldMap available?