SOQL & SOSL Flashcards
SOQL statement results can evaluate to which of the following data types:
choose 3:
A. Single SObject
B. String
C. Integer
D. List of SObjects
A. Single SObject
C. Integer
D. List of SObjects
When can SOQL return an Integer?
if a Count method is used
What does this DML statement do?
List accs;
insert accs;
Inserts accounts. No records will be committed to the database if any of them throws an exception.
What does this DML statement do?
List accs;
Database.insert(accs);
Inserts accounts. No records will be committed to the database if any of them throws an exception.
What does this DML statement do?
List accs;
Database.insert(accs, true);
Inserts accounts. No records will be committed to the database if any of them throws an exception. The second parameter in Database.insert is a Boolean that means “all or none?”
What does this DML statement do?
List accs;
Database.insert(accs, false);
Inserts accounts. Only the good records will be inserted. The second parameter in Database.insert is a Boolean that means “all or none?”
You’ll get a list back of all the good records in Database.SaveResult
A developer has written the following code to do a SOSL search
FIND {New York}
What will be returned?
A. A list of Contacts that match the search term
B. A map of Accounts or Contacts that match the search term
C. A map of sObjects that match the search term
D. A list of lists of sObjects and their records that match the search term
D. A list of lists of sObjects and their records that match the search term
How would a developer write a query to return the number of leads for each lead source?
A. SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY Leadsource
B. SELECT COUNT(LeadSource) FROM Lead
C. SELECT GROUP(LeadSource) FROM Lead
D. SELECT Count(*) FROM Lead GROUP BY LeadSource
A. SELECT LeadSource, COUNT(Name) FROM Lead GROUP BY Leadsource