# Default Account Rating

**Type:** Apex trigger · **Difficulty:** Easy · **Object:** Account · **Topics:** before insert, Bulkification

Practice this problem interactively (write and run your Apex trigger against realistic data): https://www.forcechallenges.com/problems/default-account-rating

## Problem

Write a **before insert** trigger on **Account** that sets a default `Rating` when none is provided:

| AnnualRevenue | Rating |
|---|---|
| ≥ 1,000,000 | `Hot` |
| ≥ 100,000 | `Warm` |
| otherwise / null | `Cold` |

If the user already supplied a Rating, leave it unchanged.

Your trigger runs against bulk inserts of up to 500 records, delivered in **chunks of 200** exactly like Salesforce.

## Constraints

- No SOQL and no DML are needed — modify `Trigger.new` directly in the before context.
- Must handle 200+ records per invocation.

---
Source: ForceChallenges · last updated 2026-10-02
