<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: 2024-06
Current date: 2026-01-05
Reasoning: low
# Valid channels: analysis, commentary, final. Channel must be included for every message.<|end|><|start|>user<|message|>
You are an expert in SQL++ query generation. You will be given a document schema and a natural language query. You need to generate a valid SQL++ query equivalent to the natural language query.
Bucket Name: `travel-sample`
Scope Name: inventory
Use the given document schema to generate the SQL++ query.
Document Schema:
{'route': {'properties': {'airline': {'samples': ['AM', 'B6'], 'type': 'string'}, 'airlineid': {'samples': ['airline_2009', 'airline_2638'], 'type': 'string'}, 'destinationairport': {'samples': ['ATL', 'IDA'], 'type': 'string'}, 'distance': {'samples': [303.2327637772, 1107.5683839502], 'type': 'number'}, 'equipment': {'samples': ['320', '738'], 'type': 'string'}, 'id': {'samples': [11138, 13958], 'type': 'number'}, 'schedule': {'items': {'properties': {'day': {'type': 'number'}, 'flight': {'type': 'string'}, 'utc': {'type': 'string'}}, 'type': 'object'}, 'samples': [[{'day': 0, 'flight': 'AM701', 'utc': '21:46:00'}], [{'day': 0, 'flight': 'B6285', 'utc': '16:12:00'}]], 'type': 'array'}, 'sourceairport': {'samples': ['BOS', 'IAH'], 'type': 'string'}, 'stops': {'samples': [0], 'type': 'number'}, 'type': {'samples': ['route'], 'type': 'string'}, '~meta': {'properties': {'id': {'samples': ['route_11138', 'route_13958'], 'type': 'string'}}, 'samples': [{'id': 'route_11138'}, {'id': 'route_13958'}], 'type': 'object'}}, 'type': 'object'}}
Natural Language Query
Which routes in the route collection rank first by the shortest distance within each destination airport when limited to seven results?
SQL++ Query:
<|end|><|start|>assistant<|channel|>analysis<|message|>I'll start generating SQL++ statement now.<|end|><|start|>assistant<|channel|>final<|message|>
```sql++
SELECT d.id, d.destinationairport, ROW_NUMBER() OVER (PARTITION BY d.destinationairport ORDER BY d.distance NULLS FIRST) AS `row` FROM route AS d LIMIT 7;
<|end|><|return|>
## Val Dataset Example
<|start|>system<|message|>You are ChatGPT, a large language model trained by OpenAI.
Knowledge cutoff: 2024-06
Current date: 2026-01-05
Reasoning: low
Valid channels: analysis, commentary, final. Channel must be included for every message.<|end|><|start|>user<|message|>
You are an expert in SQL++ query generation. You will be given a document schema and a natural language query. You need to generate a valid SQL++ query equivalent to the natural language query.
Bucket Name: travel-sample
Scope Name: inventory
Use the given document schema to generate the SQL++ query.