# Natural language to SQL reference cases

Proposed test record for a non-production reporting dataset. No implementation or query results are claimed.

Reporting owner: [role]. Database/security owner: [role]. Snapshot/schema version: [ID]. Approved relations/columns/functions: [list]. Effective non-owner role and identity mapping: [reference]. Parser/validator version: [value]. Statement/lock/resource/output limits: [values agreed before run].

## Define the measure

Question: [wording]. Meaning: [business definition]. Date field and inclusive/exclusive boundaries: [values]. Timezone/currency/GST/credits: [rules]. Company/user scope: [trusted mapping]. Freshness: [snapshot time]. Reference SQL and independently calculated result: [approved reference].

| Case | Expected service behaviour | Expected result/reference | Actual/evidence |
| --- | --- | --- | --- |
| Exact question and paraphrase | Same approved interpretation | To calculate independently | Not run |
| First/last boundary, empty set, duplicate-producing join | Match reviewed definitions | To calculate independently | Not run |
| Current status versus historical status ambiguity | Clarify or decline unsupported history | No query until resolved | Not run |
| Other user/company's records | Deny disclosure, including small-group inference cases | Restricted scope | Not run |
| Multiple statements, write CTE, unsupported function/relation | Reject before execution | No execution | Not run |
| Permission service unavailable or access revoked | Stop without broader fallback | No disclosure | Not run |
| Timeout, cancellation, truncated response | Distinguish failure/partial result from an empty set | Explicit execution status | Not run |
| Narrative changes a returned number | Suppress incorrect explanation | Source result retained | Not run |

Review direct query-service calls and assistant output. A SELECT prefix, JSON schema or read-only transaction is insufficient authorisation. Exclude direct ERP database access unless the owner establishes equivalent or narrower application entitlements. Keep secrets outside prompts.

Decision: [limited pilot/change/stop]. Disable/revoke procedure: [reference]. Manual alternative: approved reports and analyst queue. Re-run after model, parser, schema, policy or measure changes.
