Views
No views yet
<|im_start|>system
You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>
<|im_start|>user
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:
{"landmark": {"properties": {"activity": {"samples": ["buy"], "type": "string"}, "address": {"samples": [["21 Elizabeth St, SW1W 9RP"]], "type": "string"}, "alt": {"samples": [["Kings Head"]], "type": "string"}, "city": {"samples": [["Hornchurch"]], "type": "string"}, "content": {"samples": ["All manner of Middle Eastern f..."], "type": "string"}, "country": {"samples": ["France"], "type": "string"}, "directions": {"samples": [["Located just south of Hornchur..."]], "type": "string"}, "email": {"samples": [["contact@noevalleybakery.com"]], "type": "string"}, "geo": {"properties": {"accuracy": {"samples": ["APPROXIMATE"], "type": "string"}, "lat": {"samples": [50.120496], "type": "number"}, "lon": {"samples": [-5.535092], "type": "number"}}, "type": "object"}, "hours": {"samples": [["M-F 7:30AM-4PM, Sa 8AM-4PM, Su..."]], "type": "string"}, "id": {"samples": [11965], "type": "number"}, "image": {"samples": [["https://en.wikivoyage.org/wiki..."]], "type": "string"}, "image_direct_url": {"samples": ["https://upload.wikimedia.org/w..."], "type": "string"}, "name": {"samples": ["Friar's Inn"], "type": "string"}, "phone": {"samples": [["+44 1708 450894"]], "type": "string"}, "price": {"samples": [["Prices and opening hours set i..."]], "type": "string"}, "state": {"samples": [["California"]], "type": "string"}, "title": {"samples": ["London/Hammersmith and Fulham"], "type": "string"}, "tollfree": {"samples": [["+1 800 546-2070"]], "type": "string"}, "type": {"samples": ["landmark"], "type": "string"}, "url": {"samples": [["http://www.farmtablesf.com"]], "type": "string"}}, "type": "object"}, "route": {"properties": {"airline": {"samples": ["AS"], "type": "string"}, "airlineid": {"samples": ["airline_1316"], "type": "string"}, "destinationairport": {"samples": ["ATL"], "type": "string"}, "distance": {"samples": [960.5866347178], "type": "number"}, "equipment": {"samples": [["73G"]], "type": "string"}, "id": {"samples": [11746], "type": "number"}, "schedule": {"items": {"properties": {"day": {"type": "number"}, "flight": {"type": "string"}, "utc": {"type": "string"}}, "type": "object"}, "samples": [[{"day": 0, "flight": "AS298", "utc": "06:09:00"}]], "type": "array"}, "sourceairport": {"samples": ["CMN"], "type": "string"}, "stops": {"samples": [0], "type": "number"}, "type": {"samples": ["route"], "type": "string"}}, "type": "object"}, "airport": {"properties": {"airportname": {"samples": ["Harrisburg Intl"], "type": "string"}, "city": {"samples": ["Harrisburg"], "type": "string"}, "country": {"samples": ["France"], "type": "string"}, "faa": {"samples": [["JFK"]], "type": "string"}, "geo": {"properties": {"alt": {"samples": [8], "type": "number"}, "lat": {"samples": [25.79325], "type": "number"}, "lon": {"samples": [-80.290556], "type": "number"}}, "type": "object"}, "icao": {"samples": [["EGEO"]], "type": "string"}, "id": {"samples": [3542], "type": "number"}, "type": {"samples": ["airport"], "type": "string"}, "tz": {"samples": ["America/Anchorage"], "type": "string"}}, "type": "object"}, "airline": {"properties": {"callsign": {"samples": [["AIRLINAIR"]], "type": "string"}, "country": {"samples": ["France"], "type": "string"}, "iata": {"samples": [["A5"]], "type": "string"}, "icao": {"samples": ["CCM"], "type": "string"}, "id": {"samples": [10], "type": "number"}, "name": {"samples": ["40-Mile Air"], "type": "string"}, "type": {"samples": ["airline"], "type": "string"}}, "type": "object"}, "hotel": {"properties": {"address": {"samples": [["39 Abbey Street, Armagh, BT61 ..."]], "type": "string"}, "alias": {"samples": [["Inn Exile"]], "type": "string"}, "checkin": {"samples": [["3PM"]], "type": "string"}, "checkout": {"samples": [["11AM"]], "type": "string"}, "city": {"samples": [["Argyll and Bute"]], "type": "string"}, "country": {"samples": ["France"], "type": "string"}, "description": {"samples": ["28 bed SYHA hostel, with beds ..."], "type": "string"}, "directions": {"samples": [["M\u00e9tro: Concorde"]], "type": "string"}, "email": {"samples": [["info@Lajoyainn.com"]], "type": "string"}, "fax": {"samples": [["+1 415 665-5440"]], "type": "string"}, "free_breakfast": {"samples": [false], "type": "boolean"}, "free_internet": {"samples": [false], "type": "boolean"}, "free_parking": {"samples": [false], "type": "boolean"}, "geo": {"properties": {"accuracy": {"samples": ["APPROXIMATE"], "type": "string"}, "lat": {"samples": [52.44779], "type": "number"}, "lon": {"samples": [-6.6584], "type": "number"}}, "type": "object"}, "id": {"samples": [1097], "type": "number"}, "name": {"samples": ["Armagh City Youth Hostel"], "type": "string"}, "pets_ok": {"samples": [false], "type": "boolean"}, "phone": {"samples": [["+44 121 236 4031"]], "type": "string"}, "price": {"samples": [["$12 a night"]], "type": "string"}, "public_likes": {"items": {"type": "string"}, "samples": [["Caden Schinner"]], "type": "array"}, "reviews": {"items": {"properties": {"author": {"samples": ["Imelda Renner"], "type": "string"}, "content": {"samples": ["Dont be mislead by some hotel ..."], "type": "string"}, "date": {"samples": ["2012-11-10 17:29:26 +0300"], "type": "string"}, "ratings": {"properties": {"Business service": {"samples": [-1], "type": "number"}, "Business service (e.g., internet access)": {"samples": [1], "type": "number"}, "Check in / front desk": {"samples": [-1], "type": "number"}, "Cleanliness": {"samples": [-1], "type": "number"}, "Location": {"samples": [-1], "type": "number"}, "Overall": {"samples": [1], "type": "number"}, "Rooms": {"samples": [-1], "type": "number"}, "Service": {"samples": [-1], "type": "number"}, "Sleep Quality": {"samples": [2], "type": "number"}, "Value": {"samples": [-1], "type": "number"}}, "type": "object"}}, "type": "object"}, "samples": [[{"author": "Bart Simonis PhD", "content": "I booked two rooms for Saturday so my wife and I could take our two young children and her parents t...", "date": "2013-12-18 22:51:08 +0300", "ratings": {"Cleanliness": 5, "Location": 5, "Overall": 3, "Rooms": 3, "Service": 5, "Sleep Quality": 5, "Value": 5}}]], "type": "array"}, "state": {"samples": [["California"]], "type": "string"}, "title": {"samples": ["Armagh"], "type": "string"}, "tollfree": {"samples": [["+1-800-962-0186"]], "type": "string"}, "type": {"samples": ["hotel"], "type": "string"}, "url": {"samples": [["http://www.cpbirminghamnechote..."]], "type": "string"}, "vacancy": {"samples": [false], "type": "boolean"}}, "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:
<|im_end|>
<|im_start|>assistant
\`\`\`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;
\`\`\`
<|im_end|>