Salesforce’s SOQL Statement Is Stranger than You Think
Salesforce’s SOQL language is deceptively like other database query languages — at least on the surface.
However, if you are not aware of its quirks you will be “bitten” some day. Here is a short quiz.

How many records will the following SOQL statement return?
SELECT Id, Name FROM Account LIMIT 5000
Assuming that there are more than 5000 records in your Account table and you have permission to see all of them, is the answer:
- 5000
- 2000 then 2000 then 1000
- Between 1 and 5000
- Between 0 and 5000
- 980 then 2000 then 920 then 1100
- 4087

What is the largest SystemModStamp returned by the following SOQL statement?
SELECT Id, SystemModStamp FROM Account WHERE SystemModStamp < 2019-01-01T00:00:00.000Z LIMIT 5000
Assuming that there are records which match the criteria and you have permission to see the the records, is the answer:
- A value before 2019-01-01T00:00:000Z
- A value later than 2019-01-01T00:00:000Z
- 2019-01-01T00:00:00.000Z





Your Score
How many did you get right? It you scored 100% then congratulations! You scored way higher than me when I started working with Salesforce. My education has taken well over a decade.