17 lines
864 B
Plaintext
17 lines
864 B
Plaintext
Task: build two parallel Postgres SELECT queries that compute the same metric across two different time windows, so an analyst can compare them.
|
|
|
|
Output: a JSON object with exactly this shape, in one fenced ```json block:
|
|
{
|
|
"a": {"label": "<short period label, e.g. '1995'>", "sql": "<SELECT …>"},
|
|
"b": {"label": "<short period label, e.g. '1996'>", "sql": "<SELECT …>"}
|
|
}
|
|
|
|
Constraints:
|
|
- The two queries must return result sets with the same columns and shape — otherwise the diff is meaningless.
|
|
- Dates are stored as YYMMDD integers; convert with TO_DATE(LPAD(date::text, 6, '0'), 'YYMMDD') when filtering by date.
|
|
- Quote `"order"` if you reference it.
|
|
- search_path is `financial`; don't qualify table names with the schema.
|
|
- Read-only.
|
|
|
|
If either period is given as "(infer)", pick a sensible window from the question and reflect it in the label.
|