Aggregate queries compute counts or grouped summaries without loading every matching record into application logic.
Before you start
You should understand tables, records and the difference between client-side and server-side scripts. Work in a development instance with representative permissions. Identify execution scope, transaction timing and the current user before attributing behavior to a platform script or business rule.
The practical goal is to reason through this situation: Count active incidents by assignment group through an aggregate operation. Read the walkthrough first, then try the interview exercise before opening its answer. The important part is explaining the decision and its consequences, rather than remembering a definition alone.
Step-by-step walkthrough
Step 1: Define summary grain
Choose counts per assignment group under an explicit incident filter.
Step 2: Use aggregate processing
Compute the summary without transferring every record into script logic.
Step 3: Validate empty groups
Missing assignments and zero results need understood output behavior.
Worked scenario
Count active incidents by assignment group through an aggregate operation.
A dashboard requires active incident counts by group, not each incident’s fields. An aggregate query performs that summary more directly than a GlideRecord loop counting records. Seed two groups and unassigned incidents, then compare the totals so the grouping contract is visible rather than inferred from production data.
Common mistake
Looping over all records just to count increases transfer and processing work.
Verify the behavior
Compare grouped totals with a small known dataset including no matching records.
Interview exercise
Return an operational summary.
Answer and reasoning
Define the grouping and filters, verify null or empty groups and compare totals against controlled sample data.
Continue learning
Compare the scenario with the ServiceNow interview questions and test your understanding with the ServiceNow MCQs. For terminology and implementation details, consult the reference material.