# How does FIELDS(ALL), FIELDS(STANDARD), and FIELDS(CUSTOM) work in SOQL, and what are their limitations in Apex?

**Topic:** Soql · **Difficulty:** Medium · **Asked at:** Deloitte, PwC, Capgemini · **Tags:** soql, fields

Read it on the site: https://www.forcechallenges.com/interview-questions/how-does-fields-all-fields-standard-and-fields-custom-work-in-soql-and-what-are-their-limitations-in-apex

## Answer

`FIELDS()` avoids listing every field:
- `FIELDS(STANDARD)`: all standard fields
- `FIELDS(CUSTOM)`: all custom fields
- `FIELDS(ALL)`: all fields

```soql
SELECT FIELDS(ALL) FROM Account LIMIT 200
```
**Limitations:** `FIELDS(ALL)` and `FIELDS(CUSTOM)` require `LIMIT 200` or less in Apex and most contexts (STANDARD has no such limit); you can't use them in subqueries or nested selects, and heavy use increases heap and query cost. For production code, selecting explicit fields is still recommended.

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