Yashotantra Academy logo

2 · Salesforce Developer

4. Apex and SOQL

Salesforce's Java-like language and its query language.

14 min read · 3 MCQs

Governor limits

Apex runs on shared servers, so each transaction has limits such as 100 SOQL queries and 150 DML statements (synchronous). Write bulk-safe code: query once, work on lists, save once.

List<Account> accs = [SELECT Id, Name FROM Account WHERE Industry = 'Education' LIMIT 200];
for (Account a : accs) {
    a.Description = 'Education customer';
}
update accs; // one DML for the whole list

SOQL vs SOSL

SOQL queries one object and its related objects. SOSL searches text across many objects at once.

Chapter quiz

3 questions · pass mark 75%
  1. 1. Why must Apex be 'bulkified'?

  2. 2. How many synchronous SOQL queries are allowed per transaction?

  3. 3. Which language searches text across multiple objects?