//Salesforce’s SOQL Statement Is Stranger than You Think

Salesforce’s SOQL Statement Is Stranger than You Think

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:

  1. 5000
  2. 2000 then 2000 then 1000
  3. Between 1 and 5000
  4. Between 0 and 5000
  5. 980 then 2000 then 920 then 1100
  6. 4087
Click for Answer!

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:

  1. A value before 2019-01-01T00:00:000Z
  2. A value later than 2019-01-01T00:00:000Z
  3. 2019-01-01T00:00:00.000Z
Click for Answer!

Are all of the email addresses returned by this SOQL valid?

SELECT Id, Email FROM CONTACT WHERE Email <> null

Assuming that there are records to read, is the answer:

  1. Yes
  2. No
Click for Answer!

How long is the longest string value in this 80 character field – Name?

SELECT Id, Name FROM EmailTemplate

Click for Answer!

How many API Calls does this SOQL statement take using REST?

SELECT Id, Title, Body FROM Attachment WHERE Id <> NULL LIMIT 50

SELECT Id,  Title, Body FROM Attachment WHERE Id <> NULL LIMIT 50

  1. 1
  2. 2
  3. 5
  4. 40
  5. 51
Click for Answer!

How many API Calls to read all columns in a table for a single record?

Consider this pseudo SOQL:

  • SELECT Id,  Name,…all columns… FROM Account LIMIT 1

Will this SOQL statement work? If not then how many SOQL calls are needed?

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. It may be different every day
Click for Answer!

How Large of a Number Can Be Stored in a Salesforce Number field?

This is the last question so it is an easy one.

  1. 999,999,999,999,999,999 (18 digits — count them)
  2. 6.022E+23
  3. 1.79769E+308
Click for Answer!

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.

2020-01-31T20:46:44+00:00