Find missing Contact emails
SOQL uses = null and != null to find fields that are empty or filled in.
Your task
Split this run's Contacts into those with no Email and those with an Email.
String tag = 'AS-Q305-' + UserInfo.getUserId() + '-' +
String.valueOf(Datetime.now().getTime());
Account parent = new Account(Name = tag);
insert parent;
String presentEmail = 'q' + String.valueOf(Datetime.now().getTime()) + '@example.com';
List<Contact> seeded = new List<Contact>{
new Contact(LastName = tag + '-Null', AccountId = parent.Id, Email = null),
new Contact(LastName = tag + '-Present', AccountId = parent.Id, Email = presentEmail),
new Contact(LastName = tag + '-Blank', AccountId = parent.Id, Email = '')
};
insert seeded;
List<Contact> missing = new List<Contact>();
List<Contact> present = new List<Contact>();
System.debug('Null missing: ' + missing.size());
System.debug('Null present: ' + present.size());
System.debug('Null blank is missing: false');
System.debug('Null present excluded: false');Requirements
Null missing: 2should be built from the query resultEmail = nullshould be presentEmail != nullshould be presentNull missing: 2should be printedNull present: 1should be printedNull blank is missing: trueshould be printedNull present excluded: trueshould be printed