training_input
stringlengths
118
1.06k
###context:CREATE TABLE Lessons (lesson_status_code VARCHAR) ###human: How many lessons were in cancelled state? ###assistant: SELECT COUNT(*) FROM Lessons WHERE lesson_status_code = "Cancelled"
###context:CREATE TABLE Lessons (lesson_id VARCHAR, staff_id VARCHAR); CREATE TABLE Staff (staff_id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###human: List lesson id of all lessons taught by staff with first name as Janessa, last name as Sawayn and nickname containing letter 's'. ###assistant: SELECT T1.lesson_id FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn" AND nickname LIKE "%s%"
###context:CREATE TABLE Lessons (staff_id VARCHAR); CREATE TABLE Staff (staff_id VARCHAR, first_name VARCHAR) ###human: How many lessons taught by staff whose first name has letter 'a' in it? ###assistant: SELECT COUNT(*) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name LIKE "%a%"
###context:CREATE TABLE Lessons (staff_id VARCHAR); CREATE TABLE Staff (staff_id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###human: How long is the total lesson time taught by staff with first name as Janessa and last name as Sawayn? ###assistant: SELECT SUM(lesson_time) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"
###context:CREATE TABLE Lessons (staff_id VARCHAR); CREATE TABLE Staff (staff_id VARCHAR, first_name VARCHAR, last_name VARCHAR) ###human: What is average lesson price taught by staff with first name as Janessa and last name as Sawayn? ###assistant: SELECT AVG(price) FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = "Janessa" AND T2.last_name = "Sawayn"
###context:CREATE TABLE Customers (customer_id VARCHAR, first_name VARCHAR); CREATE TABLE Lessons (customer_id VARCHAR) ###human: How many lesson does customer with first name Ray took? ###assistant: SELECT COUNT(*) FROM Lessons AS T1 JOIN Customers AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = "Ray"
###context:CREATE TABLE Customers (last_name VARCHAR); CREATE TABLE Staff (last_name VARCHAR) ###human: Which last names are both used by customers and by staff? ###assistant: SELECT last_name FROM Customers INTERSECT SELECT last_name FROM Staff
###context:CREATE TABLE Lessons (staff_id VARCHAR); CREATE TABLE Staff (first_name VARCHAR); CREATE TABLE Staff (first_name VARCHAR, staff_id VARCHAR) ###human: What is the first name of the staff who did not give any lesson? ###assistant: SELECT first_name FROM Staff EXCEPT SELECT T2.first_name FROM Lessons AS T1 JOIN Staff AS T2 ON T1.staff_id = T2.staff_id
###context:CREATE TABLE Lessons (vehicle_id VARCHAR); CREATE TABLE Vehicles (vehicle_id VARCHAR, vehicle_details VARCHAR) ###human: What is the id and detail of the vehicle used in lessons for most of the times? ###assistant: SELECT T1.vehicle_id, T1.vehicle_details FROM Vehicles AS T1 JOIN Lessons AS T2 ON T1.vehicle_id = T2.vehicle_id GROUP BY T1.vehicle_id ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Faculty (Id VARCHAR) ###human: How many faculty do we have? ###assistant: SELECT COUNT(*) FROM Faculty
###context:CREATE TABLE Faculty (rank VARCHAR) ###human: What ranks do we have for faculty? ###assistant: SELECT DISTINCT rank FROM Faculty
###context:CREATE TABLE Faculty (building VARCHAR) ###human: Show all the distinct buildings that have faculty rooms. ###assistant: SELECT DISTINCT building FROM Faculty
###context:CREATE TABLE Faculty (rank VARCHAR, Fname VARCHAR, Lname VARCHAR) ###human: Show the rank, first name, and last name for all the faculty. ###assistant: SELECT rank, Fname, Lname FROM Faculty
###context:CREATE TABLE Faculty (Fname VARCHAR, Lname VARCHAR, phone VARCHAR, Sex VARCHAR) ###human: Show the first name, last name, and phone number for all female faculty members. ###assistant: SELECT Fname, Lname, phone FROM Faculty WHERE Sex = 'F'
###context:CREATE TABLE Faculty (FacID VARCHAR, Sex VARCHAR) ###human: Show ids for all the male faculty. ###assistant: SELECT FacID FROM Faculty WHERE Sex = 'M'
###context:CREATE TABLE Faculty (Sex VARCHAR, Rank VARCHAR) ###human: How many female Professors do we have? ###assistant: SELECT COUNT(*) FROM Faculty WHERE Sex = 'F' AND Rank = "Professor"
###context:CREATE TABLE Faculty (phone VARCHAR, room VARCHAR, building VARCHAR, Fname VARCHAR, Lname VARCHAR) ###human: Show the phone, room, and building for the faculty named Jerry Prince. ###assistant: SELECT phone, room, building FROM Faculty WHERE Fname = "Jerry" AND Lname = "Prince"
###context:CREATE TABLE Faculty (Rank VARCHAR, building VARCHAR) ###human: How many Professors are in building NEB? ###assistant: SELECT COUNT(*) FROM Faculty WHERE Rank = "Professor" AND building = "NEB"
###context:CREATE TABLE Faculty (fname VARCHAR, lname VARCHAR, Rank VARCHAR) ###human: Show the first name and last name for all the instructors. ###assistant: SELECT fname, lname FROM Faculty WHERE Rank = "Instructor"
###context:CREATE TABLE Faculty (building VARCHAR) ###human: Show all the buildings along with the number of faculty members the buildings have. ###assistant: SELECT building, COUNT(*) FROM Faculty GROUP BY building
###context:CREATE TABLE Faculty (building VARCHAR) ###human: Which building has most faculty members? ###assistant: SELECT building FROM Faculty GROUP BY building ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Faculty (building VARCHAR, rank VARCHAR) ###human: Show all the buildings that have at least 10 professors. ###assistant: SELECT building FROM Faculty WHERE rank = "Professor" GROUP BY building HAVING COUNT(*) >= 10
###context:CREATE TABLE Faculty (rank VARCHAR) ###human: For each faculty rank, show the number of faculty members who have it. ###assistant: SELECT rank, COUNT(*) FROM Faculty GROUP BY rank
###context:CREATE TABLE Faculty (rank VARCHAR, sex VARCHAR) ###human: Show all the ranks and the number of male and female faculty for each rank. ###assistant: SELECT rank, sex, COUNT(*) FROM Faculty GROUP BY rank, sex
###context:CREATE TABLE Faculty (rank VARCHAR) ###human: Which rank has the smallest number of faculty members? ###assistant: SELECT rank FROM Faculty GROUP BY rank ORDER BY COUNT(*) LIMIT 1
###context:CREATE TABLE Faculty (sex VARCHAR, rank VARCHAR) ###human: Show the number of male and female assistant professors. ###assistant: SELECT sex, COUNT(*) FROM Faculty WHERE rank = "AsstProf" GROUP BY sex
###context:CREATE TABLE Student (advisor VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE Faculty (fname VARCHAR, lname VARCHAR, FacID VARCHAR) ###human: What are the first name and last name of Linda Smith's advisor? ###assistant: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T2.fname = "Linda" AND T2.lname = "Smith"
###context:CREATE TABLE Student (StuID VARCHAR, advisor VARCHAR); CREATE TABLE Faculty (FacID VARCHAR, rank VARCHAR) ###human: Show the ids of students whose advisors are professors. ###assistant: SELECT T2.StuID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.rank = "Professor"
###context:CREATE TABLE Faculty (FacID VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE Student (fname VARCHAR, lname VARCHAR, advisor VARCHAR) ###human: Show first name and last name for all the students advised by Michael Goodrich. ###assistant: SELECT T2.fname, T2.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor WHERE T1.fname = "Michael" AND T1.lname = "Goodrich"
###context:CREATE TABLE Faculty (FacID VARCHAR); CREATE TABLE Student (advisor VARCHAR) ###human: Show the faculty id of each faculty member, along with the number of students he or she advises. ###assistant: SELECT T1.FacID, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID
###context:CREATE TABLE Student (advisor VARCHAR); CREATE TABLE Faculty (rank VARCHAR, FacID VARCHAR) ###human: Show all the faculty ranks and the number of students advised by each rank. ###assistant: SELECT T1.rank, COUNT(*) FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.rank
###context:CREATE TABLE Student (advisor VARCHAR); CREATE TABLE Faculty (fname VARCHAR, lname VARCHAR, FacID VARCHAR) ###human: What are the first and last name of the faculty who has the most students? ###assistant: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Faculty (FacID VARCHAR); CREATE TABLE Student (advisor VARCHAR) ###human: Show the ids for all the faculty members who have at least 2 students. ###assistant: SELECT T1.FacID FROM Faculty AS T1 JOIN Student AS T2 ON T1.FacID = T2.advisor GROUP BY T1.FacID HAVING COUNT(*) >= 2
###context:CREATE TABLE Faculty (FacID VARCHAR, advisor VARCHAR); CREATE TABLE Student (FacID VARCHAR, advisor VARCHAR) ###human: Show ids for the faculty members who don't advise any student. ###assistant: SELECT FacID FROM Faculty EXCEPT SELECT advisor FROM Student
###context:CREATE TABLE Activity (activity_name VARCHAR) ###human: What activities do we have? ###assistant: SELECT activity_name FROM Activity
###context:CREATE TABLE Activity (Id VARCHAR) ###human: How many activities do we have? ###assistant: SELECT COUNT(*) FROM Activity
###context:CREATE TABLE Faculty_participates_in (FacID VARCHAR) ###human: How many faculty members participate in an activity? ###assistant: SELECT COUNT(DISTINCT FacID) FROM Faculty_participates_in
###context:CREATE TABLE Faculty (FacID VARCHAR); CREATE TABLE Faculty_participates_in (FacID VARCHAR) ###human: Show the ids of the faculty who don't participate in any activity. ###assistant: SELECT FacID FROM Faculty EXCEPT SELECT FacID FROM Faculty_participates_in
###context:CREATE TABLE Student (FacID VARCHAR, advisor VARCHAR); CREATE TABLE Faculty_participates_in (FacID VARCHAR, advisor VARCHAR) ###human: Show the ids of all the faculty members who participate in an activity and advise a student. ###assistant: SELECT FacID FROM Faculty_participates_in INTERSECT SELECT advisor FROM Student
###context:CREATE TABLE Faculty_participates_in (facID VARCHAR); CREATE TABLE Faculty (facID VARCHAR, fname VARCHAR, lname VARCHAR) ###human: How many activities does Mark Giuliano participate in? ###assistant: SELECT COUNT(*) FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
###context:CREATE TABLE Activity (activity_name VARCHAR, actid VARCHAR); CREATE TABLE Faculty (facID VARCHAR, fname VARCHAR, lname VARCHAR); CREATE TABLE Faculty_participates_in (facID VARCHAR, actid VARCHAR) ###human: Show the names of all the activities Mark Giuliano participates in. ###assistant: SELECT T3.activity_name FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN Activity AS T3 ON T3.actid = T2.actid WHERE T1.fname = "Mark" AND T1.lname = "Giuliano"
###context:CREATE TABLE Faculty_participates_in (facID VARCHAR); CREATE TABLE Faculty (fname VARCHAR, lname VARCHAR, FacID VARCHAR, facID VARCHAR) ###human: Show the first and last name of all the faculty members who participated in some activity, together with the number of activities they participated in. ###assistant: SELECT T1.fname, T1.lname, COUNT(*), T1.FacID FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID
###context:CREATE TABLE Faculty_participates_in (actID VARCHAR); CREATE TABLE Activity (activity_name VARCHAR, actID VARCHAR) ###human: Show all the activity names and the number of faculty involved in each activity. ###assistant: SELECT T1.activity_name, COUNT(*) FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID
###context:CREATE TABLE Faculty_participates_in (facID VARCHAR); CREATE TABLE Faculty (fname VARCHAR, lname VARCHAR, FacID VARCHAR, facID VARCHAR) ###human: What is the first and last name of the faculty participating in the most activities? ###assistant: SELECT T1.fname, T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID GROUP BY T1.FacID ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Faculty_participates_in (actID VARCHAR); CREATE TABLE Activity (activity_name VARCHAR, actID VARCHAR) ###human: What is the name of the activity that has the most faculty members involved in? ###assistant: SELECT T1.activity_name FROM Activity AS T1 JOIN Faculty_participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Participates_in (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR) ###human: Show the ids of the students who don't participate in any activity. ###assistant: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Participates_in
###context:CREATE TABLE Student (StuID VARCHAR, age INTEGER); CREATE TABLE Participates_in (StuID VARCHAR, age INTEGER) ###human: Show the ids for all the students who participate in an activity and are under 20. ###assistant: SELECT StuID FROM Participates_in INTERSECT SELECT StuID FROM Student WHERE age < 20
###context:CREATE TABLE Student (fname VARCHAR, lname VARCHAR, StuID VARCHAR); CREATE TABLE Participates_in (StuID VARCHAR) ###human: What is the first and last name of the student participating in the most activities? ###assistant: SELECT T1.fname, T1.lname FROM Student AS T1 JOIN Participates_in AS T2 ON T1.StuID = T2.StuID GROUP BY T1.StuID ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE Participates_in (actID VARCHAR); CREATE TABLE Activity (activity_name VARCHAR, actID VARCHAR) ###human: What is the name of the activity with the most students? ###assistant: SELECT T1.activity_name FROM Activity AS T1 JOIN Participates_in AS T2 ON T1.actID = T2.actID GROUP BY T1.actID ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE activity (activity_name VARCHAR); CREATE TABLE Faculty_participates_in (facID VARCHAR, actid VARCHAR); CREATE TABLE Faculty (lname VARCHAR, facID VARCHAR) ###human: Find the first names of the faculty members who are playing Canoeing or Kayaking. ###assistant: SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
###context:CREATE TABLE faculty (lname VARCHAR, rank VARCHAR); CREATE TABLE activity (activity_name VARCHAR); CREATE TABLE Faculty_participates_in (facID VARCHAR, actid VARCHAR); CREATE TABLE Faculty (lname VARCHAR, facID VARCHAR) ###human: Find the first names of professors who are not playing Canoeing or Kayaking. ###assistant: SELECT lname FROM faculty WHERE rank = 'Professor' EXCEPT SELECT DISTINCT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' OR T3.activity_name = 'Kayaking'
###context:CREATE TABLE activity (activity_name VARCHAR); CREATE TABLE Faculty_participates_in (facID VARCHAR, actid VARCHAR); CREATE TABLE Faculty (lname VARCHAR, facID VARCHAR) ###human: Find the first names of the faculty members who participate in Canoeing and Kayaking. ###assistant: SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Canoeing' INTERSECT SELECT T1.lname FROM Faculty AS T1 JOIN Faculty_participates_in AS T2 ON T1.facID = T2.facID JOIN activity AS T3 ON T2.actid = T2.actid WHERE T3.activity_name = 'Kayaking'
###context:CREATE TABLE activity (actid VARCHAR, activity_name VARCHAR); CREATE TABLE participates_in (stuid VARCHAR) ###human: Find the ids of the students who participate in Canoeing and Kayaking. ###assistant: SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Canoeing' INTERSECT SELECT T1.stuid FROM participates_in AS T1 JOIN activity AS T2 ON T2.actid = T2.actid WHERE T2.activity_name = 'Kayaking'
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR) ###human: Find the name of the airport in the city of Goroka. ###assistant: SELECT name FROM airports WHERE city = 'Goroka'
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR, country VARCHAR, elevation VARCHAR) ###human: Find the name, city, country, and altitude (or elevation) of the airports in the city of New York. ###assistant: SELECT name, city, country, elevation FROM airports WHERE city = 'New York'
###context:CREATE TABLE airlines (Id VARCHAR) ###human: How many airlines are there? ###assistant: SELECT COUNT(*) FROM airlines
###context:CREATE TABLE airlines (country VARCHAR) ###human: How many airlines does Russia has? ###assistant: SELECT COUNT(*) FROM airlines WHERE country = 'Russia'
###context:CREATE TABLE airports (elevation INTEGER, country VARCHAR) ###human: What is the maximum elevation of all airports in the country of Iceland? ###assistant: SELECT MAX(elevation) FROM airports WHERE country = 'Iceland'
###context:CREATE TABLE airports (name VARCHAR, country VARCHAR) ###human: Find the name of the airports located in Cuba or Argentina. ###assistant: SELECT name FROM airports WHERE country = 'Cuba' OR country = 'Argentina'
###context:CREATE TABLE airlines (country VARCHAR, name VARCHAR) ###human: Find the country of the airlines whose name starts with 'Orbit'. ###assistant: SELECT country FROM airlines WHERE name LIKE 'Orbit%'
###context:CREATE TABLE airports (name VARCHAR, elevation INTEGER) ###human: Find the name of airports whose altitude is between -50 and 50. ###assistant: SELECT name FROM airports WHERE elevation BETWEEN -50 AND 50
###context:CREATE TABLE airports (country VARCHAR, elevation VARCHAR) ###human: Which country is the airport that has the highest altitude located in? ###assistant: SELECT country FROM airports ORDER BY elevation DESC LIMIT 1
###context:CREATE TABLE airports (name VARCHAR) ###human: Find the number of airports whose name contain the word 'International'. ###assistant: SELECT COUNT(*) FROM airports WHERE name LIKE '%International%'
###context:CREATE TABLE airports (city VARCHAR, country VARCHAR) ###human: How many different cities do have some airport in the country of Greenland? ###assistant: SELECT COUNT(DISTINCT city) FROM airports WHERE country = 'Greenland'
###context:CREATE TABLE routes (alid VARCHAR); CREATE TABLE airlines (alid VARCHAR, name VARCHAR) ###human: Find the number of routes operated by American Airlines. ###assistant: SELECT COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
###context:CREATE TABLE routes (dst_apid VARCHAR); CREATE TABLE airports (apid VARCHAR) ###human: Find the number of routes whose destination airports are in Canada. ###assistant: SELECT COUNT(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE country = 'Canada'
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR, country VARCHAR, elevation VARCHAR) ###human: Find the name, city, and country of the airport that has the lowest altitude. ###assistant: SELECT name, city, country FROM airports ORDER BY elevation LIMIT 1
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR, country VARCHAR, elevation VARCHAR) ###human: Find the name, city, and country of the airport that has the highest latitude. ###assistant: SELECT name, city, country FROM airports ORDER BY elevation DESC LIMIT 1
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR, apid VARCHAR); CREATE TABLE routes (dst_apid VARCHAR) ###human: Find the name and city of the airport which is the destination of the most number of routes. ###assistant: SELECT T1.name, T1.city, T2.dst_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid GROUP BY T2.dst_apid ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE airlines (name VARCHAR, alid VARCHAR); CREATE TABLE routes (alid VARCHAR) ###human: Find the names of the top 10 airlines that operate the most number of routes. ###assistant: SELECT T1.name, T2.alid FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T2.alid ORDER BY COUNT(*) DESC LIMIT 10
###context:CREATE TABLE airports (name VARCHAR, city VARCHAR, apid VARCHAR); CREATE TABLE routes (src_apid VARCHAR) ###human: Find the name and city of the airport which is the source for the most number of flight routes. ###assistant: SELECT T1.name, T1.city, T2.src_apid FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T2.src_apid ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE routes (alid VARCHAR); CREATE TABLE airlines (alid VARCHAR, name VARCHAR) ###human: Find the number of different airports which are the destinations of the American Airlines. ###assistant: SELECT COUNT(DISTINCT dst_apid) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid WHERE T1.name = 'American Airlines'
###context:CREATE TABLE airlines (country VARCHAR) ###human: Which countries has the most number of airlines? ###assistant: SELECT country FROM airlines GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE airlines (country VARCHAR, active VARCHAR) ###human: Which countries has the most number of airlines whose active status is 'Y'? ###assistant: SELECT country FROM airlines WHERE active = 'Y' GROUP BY country ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE airlines (country VARCHAR) ###human: List all countries and their number of airlines in the descending order of number of airlines. ###assistant: SELECT country, COUNT(*) FROM airlines GROUP BY country ORDER BY COUNT(*) DESC
###context:CREATE TABLE airports (country VARCHAR) ###human: How many airports are there per country? Order the countries by decreasing number of airports. ###assistant: SELECT COUNT(*), country FROM airports GROUP BY country ORDER BY COUNT(*) DESC
###context:CREATE TABLE airports (city VARCHAR, country VARCHAR) ###human: How many airports are there per city in the United States? Order the cities by decreasing number of airports. ###assistant: SELECT COUNT(*), city FROM airports WHERE country = 'United States' GROUP BY city ORDER BY COUNT(*) DESC
###context:CREATE TABLE airports (city VARCHAR, country VARCHAR) ###human: Return the cities with more than 3 airports in the United States. ###assistant: SELECT city FROM airports WHERE country = 'United States' GROUP BY city HAVING COUNT(*) > 3
###context:CREATE TABLE airports (city VARCHAR) ###human: How many cities are there that have more than 3 airports? ###assistant: SELECT COUNT(*) FROM (SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 3)
###context:CREATE TABLE airports (city VARCHAR) ###human: List the cities which have more than one airport and number of airports. ###assistant: SELECT city, COUNT(*) FROM airports GROUP BY city HAVING COUNT(*) > 1
###context:CREATE TABLE airports (city VARCHAR) ###human: List the cities which have more than 2 airports sorted by the number of airports. ###assistant: SELECT city FROM airports GROUP BY city HAVING COUNT(*) > 2 ORDER BY COUNT(*)
###context:CREATE TABLE airports (name VARCHAR, apid VARCHAR); CREATE TABLE routes (src_apid VARCHAR) ###human: Find the number of routes for each source airport and the airport name. ###assistant: SELECT COUNT(*), T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name
###context:CREATE TABLE airports (name VARCHAR, apid VARCHAR); CREATE TABLE routes (src_apid VARCHAR) ###human: Find the number of routes and airport name for each source airport, order the results by decreasing number of routes. ###assistant: SELECT COUNT(*), T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid GROUP BY T1.name ORDER BY COUNT(*) DESC
###context:CREATE TABLE airports (country VARCHAR, elevation INTEGER) ###human: Find the average elevation of all airports for each country. ###assistant: SELECT AVG(elevation), country FROM airports GROUP BY country
###context:CREATE TABLE airports (city VARCHAR) ###human: Find the cities which have exactly two airports. ###assistant: SELECT city FROM airports GROUP BY city HAVING COUNT(*) = 2
###context:CREATE TABLE airlines (country VARCHAR, name VARCHAR, alid VARCHAR); CREATE TABLE routes (alid VARCHAR) ###human: For each country and airline name, how many routes are there? ###assistant: SELECT T1.country, T1.name, COUNT(*) FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.country, T1.name
###context:CREATE TABLE routes (dst_apid VARCHAR); CREATE TABLE airports (apid VARCHAR, country VARCHAR) ###human: Find the number of routes with destination airports in Italy. ###assistant: SELECT COUNT(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid WHERE T2.country = 'Italy'
###context:CREATE TABLE routes (dst_apid VARCHAR, alid VARCHAR); CREATE TABLE airports (apid VARCHAR, country VARCHAR); CREATE TABLE airlines (alid VARCHAR, name VARCHAR) ###human: Return the number of routes with destination airport in Italy operated by the airline with name 'American Airlines'. ###assistant: SELECT COUNT(*) FROM routes AS T1 JOIN airports AS T2 ON T1.dst_apid = T2.apid JOIN airlines AS T3 ON T1.alid = T3.alid WHERE T2.country = 'Italy' AND T3.name = 'American Airlines'
###context:CREATE TABLE airports (apid VARCHAR, name VARCHAR); CREATE TABLE routes (dst_apid VARCHAR) ###human: Find the number of routes that have destination John F Kennedy International Airport. ###assistant: SELECT COUNT(*) FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.name = 'John F Kennedy International Airport'
###context:CREATE TABLE airports (dst_apid VARCHAR, src_apid VARCHAR, apid VARCHAR, country VARCHAR); CREATE TABLE routes (dst_apid VARCHAR, src_apid VARCHAR, apid VARCHAR, country VARCHAR) ###human: Find the number of routes from the United States to Canada. ###assistant: SELECT COUNT(*) FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'Canada') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')
###context:CREATE TABLE routes (rid VARCHAR, dst_apid VARCHAR, src_apid VARCHAR, apid VARCHAR, country VARCHAR); CREATE TABLE airports (rid VARCHAR, dst_apid VARCHAR, src_apid VARCHAR, apid VARCHAR, country VARCHAR) ###human: Find the id of routes whose source and destination airports are in the United States. ###assistant: SELECT rid FROM routes WHERE dst_apid IN (SELECT apid FROM airports WHERE country = 'United States') AND src_apid IN (SELECT apid FROM airports WHERE country = 'United States')
###context:CREATE TABLE airlines (name VARCHAR, alid VARCHAR); CREATE TABLE routes (alid VARCHAR) ###human: Find the name of airline which runs the most number of routes. ###assistant: SELECT T1.name FROM airlines AS T1 JOIN routes AS T2 ON T1.alid = T2.alid GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE routes (src_apid VARCHAR); CREATE TABLE airports (name VARCHAR, apid VARCHAR, country VARCHAR) ###human: Find the busiest source airport that runs most number of routes in China. ###assistant: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.src_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE routes (dst_apid VARCHAR); CREATE TABLE airports (name VARCHAR, apid VARCHAR, country VARCHAR) ###human: Find the busiest destination airport that runs most number of routes in China. ###assistant: SELECT T1.name FROM airports AS T1 JOIN routes AS T2 ON T1.apid = T2.dst_apid WHERE T1.country = 'China' GROUP BY T1.name ORDER BY COUNT(*) DESC LIMIT 1
###context:CREATE TABLE orders (order_id VARCHAR, date_order_placed VARCHAR) ###human: What is the id of the most recent order? ###assistant: SELECT order_id FROM orders ORDER BY date_order_placed DESC LIMIT 1
###context:CREATE TABLE orders (order_id VARCHAR, customer_id VARCHAR, date_order_placed VARCHAR) ###human: what are the order id and customer id of the oldest order? ###assistant: SELECT order_id, customer_id FROM orders ORDER BY date_order_placed LIMIT 1
###context:CREATE TABLE shipments (order_id VARCHAR, shipment_tracking_number VARCHAR) ###human: Find the id of the order whose shipment tracking number is "3452". ###assistant: SELECT order_id FROM shipments WHERE shipment_tracking_number = "3452"
###context:CREATE TABLE order_items (order_item_id VARCHAR, product_id VARCHAR) ###human: Find the ids of all the order items whose product id is 11. ###assistant: SELECT order_item_id FROM order_items WHERE product_id = 11
###context:CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR); CREATE TABLE customers (customer_name VARCHAR, customer_id VARCHAR) ###human: List the name of all the distinct customers who have orders with status "Packing". ###assistant: SELECT DISTINCT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Packing"
###context:CREATE TABLE orders (customer_id VARCHAR, order_status VARCHAR); CREATE TABLE customers (customer_details VARCHAR, customer_id VARCHAR) ###human: Find the details of all the distinct customers who have orders with status "On Road". ###assistant: SELECT DISTINCT T1.customer_details FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road"