Structuring queries
Structuring a question along a few simple parts makes it easy for STYD to build the right query.
A useful structure
Metric
What to measure — revenue, count, average.
What to measure — revenue, count, average.
Entity
What it is about — customers, products, orders.
What it is about — customers, products, orders.
Timeframe
Over what period.
Over what period.
Filter
Conditions to apply.
Conditions to apply.
Grouping
How to break it down — by month, by customer, by region.
How to break it down — by month, by customer, by region.
Sort / order
How to rank — highest first, most recent first, top 10.
How to rank — highest first, most recent first, top 10.
Examples
“Show monthly revenue for 2025 by customer.”
“Which products sold the most last quarter?”
The first names a metric (revenue), a timeframe (2025), and a grouping (by customer). The second asks for a ranking (most) over a timeframe (last quarter).
List vs summary
Decide what kind of answer you want, and ask for it:
A list / table
When you need the individual rows — “list overdue invoices with amount and due date.”
When you need the individual rows — “list overdue invoices with amount and due date.”
A summary / count / trend
When you need the big picture — “how many overdue invoices are there?” or “revenue trend by month.”
When you need the big picture — “how many overdue invoices are there?” or “revenue trend by month.”
If you are not sure, start with a summary, then ask for the detailed list as a follow-up.