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