Write a SOQL query to find all Contacts whose LastName starts with 'S' and ends with 'a'.
Answer
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