What is SOQL and how does it differ from standard SQL (e.g., no SELECT *, no arbitrary table joins)?
Answer
SOQL (Salesforce Object Query Language) queries records from Salesforce objects, similar to SQL SELECT but object-oriented.
Differences from SQL:
- No
SELECT *(use explicit fields orFIELDS()) - No arbitrary joins; only relationship queries (child-to-parent dot notation, parent-to-child subqueries) along defined relationships
- Read-only: no INSERT/UPDATE/DELETE statements (DML is separate)
- Limited functions, no
UNION, noDISTINCT-style joins; no arbitrary aliases for tables in the same way - Subject to governor limits and security (sharing, FLS)
soql
SELECT Id, Name, Account.Name FROM Contact WHERE LastName LIKE 'S%'
soqlfundamentals