This is more of a conceptual question. I was initially querying attachments related to a specific object like this -
SELECT Id, Name, ParentId, Description, BodyLength,IsDeleted,IsPrivate,CreatedById,CreatedDate FROM Attachment where
ParentId IN (Select Id from my_custom_object__c)
but it kept timing out in workbench. So someone gave me wonderful idea to write query like this
SELECT Id, Name, ParentId, Description, BodyLength,IsDeleted,IsPrivate,CreatedById,CreatedDate FROM Attachment where (ParentId > ‘a1e000000000000000’) AND (ParentId <‘a1ezzzzzzzzzzzzzzz’)
where a1e is the object prefix of my_custom_object__c.
So we kind of define a custom range a1e000000000000000 to a1ezzzzzzzzzzzzzzz, where all records of my_custom_object__c are bound to be in (as in their IDs will be in this range)
This works well. But then i started to think, which is higher "max range" - a1ezzzzzzzzzzzzzzz or a1eZZZZZZZZZZZZZZZ
I tested with one particular Id (just picked up a random contact record), and wrote following code in dev console -
//Id of a contact record
Id tempId = '0032900000EbFYyAAN';
//change capital E to small e and compare
if(tempId > '0032900000ebFYyAAN'){System.debug('@@@ capital is greater');}
if(tempId < '0032900000ebFYyAAN'){System.debug('@@@ small is greater');}
if(tempId == '0032900000ebFYyAAN'){System.debug('@@@ same');}
And it printed @@@ small is greater
So does that mean, as far as comparison of IDs go, small letters are always evaluated to be bigger than capital letters? From this one test, can i assume that it is indeed the case all the time? How does salesforce internally compare two IDs?
EDIT - After reading some comments, I guess when i write where (ParentId > ‘a1e000000000000000’) AND (ParentId <‘a1ezzzzzzzzzzzzzzz’) , i am comparing ID with string. But the question stays the same - how does it work? Am i covering entire range of records when i write this? or do i need to change it to capital Z. And to clarify, queries are being run via workbench, not inside apex code