APEX & SOQL - astromechanic/cheat_sheets Wiki

Inline SOQL: Insert an account using anonymous Apex:


Account acct = new Account(
    Name='SFDC Computing',
    Phone='(415)555-1212',
    NumberOfEmployees=50,
    BillingCity='San Francisco');
insert acct;

SOQL using Query Editor:


select Name, Phone from Account where Name='Acme'
select fields(all) from OrderItem limit 200
select Name, Phone from Account where (Name='Acme' and NumberOfEmployees>50)
select Name from Account where Name like 'Acme%' 

Collections

List:

Set:

Map: