question
stringlengths 12
244
| context
stringlengths 27
489
| answer
stringlengths 18
557
| text
stringlengths 114
1.06k
|
---|---|---|---|
Find the name of physicians whose position title contains the word 'senior'. | CREATE TABLE physician (name VARCHAR, POSITION VARCHAR) | SELECT name FROM physician WHERE POSITION LIKE '%senior%' | ### Context: CREATE TABLE physician (name VARCHAR, POSITION VARCHAR) ### Question: Find the name of physicians whose position title contains the word 'senior'. ### Answer: SELECT name FROM physician WHERE POSITION LIKE '%senior%' |
Find the patient who has the most recent undergoing treatment? | CREATE TABLE undergoes (patient VARCHAR, dateundergoes VARCHAR) | SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1 | ### Context: CREATE TABLE undergoes (patient VARCHAR, dateundergoes VARCHAR) ### Question: Find the patient who has the most recent undergoing treatment? ### Answer: SELECT patient FROM undergoes ORDER BY dateundergoes LIMIT 1 |
Find the names of all patients who have an undergoing treatment and are staying in room 111. | CREATE TABLE undergoes (patient VARCHAR, Stay VARCHAR); CREATE TABLE stay (StayID VARCHAR, room VARCHAR); CREATE TABLE patient (name VARCHAR, SSN VARCHAR) | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111 | ### Context: CREATE TABLE undergoes (patient VARCHAR, Stay VARCHAR); CREATE TABLE stay (StayID VARCHAR, room VARCHAR); CREATE TABLE patient (name VARCHAR, SSN VARCHAR) ### Question: Find the names of all patients who have an undergoing treatment and are staying in room 111. ### Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN patient AS T2 ON T1.patient = T2.SSN JOIN stay AS T3 ON T1.Stay = T3.StayID WHERE T3.room = 111 |
List the names of all distinct nurses ordered by alphabetical order? | CREATE TABLE nurse (name VARCHAR) | SELECT DISTINCT name FROM nurse ORDER BY name | ### Context: CREATE TABLE nurse (name VARCHAR) ### Question: List the names of all distinct nurses ordered by alphabetical order? ### Answer: SELECT DISTINCT name FROM nurse ORDER BY name |
Find the names of nurses who are nursing an undergoing treatment. | CREATE TABLE undergoes (AssistingNurse VARCHAR); CREATE TABLE nurse (name VARCHAR, EmployeeID VARCHAR) | SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID | ### Context: CREATE TABLE undergoes (AssistingNurse VARCHAR); CREATE TABLE nurse (name VARCHAR, EmployeeID VARCHAR) ### Question: Find the names of nurses who are nursing an undergoing treatment. ### Answer: SELECT DISTINCT T2.name FROM undergoes AS T1 JOIN nurse AS T2 ON T1.AssistingNurse = T2.EmployeeID |
List the names of all distinct medications, ordered in an alphabetical order. | CREATE TABLE medication (name VARCHAR) | SELECT DISTINCT name FROM medication ORDER BY name | ### Context: CREATE TABLE medication (name VARCHAR) ### Question: List the names of all distinct medications, ordered in an alphabetical order. ### Answer: SELECT DISTINCT name FROM medication ORDER BY name |
What are the names of the physician who prescribed the highest dose? | CREATE TABLE prescribes (physician VARCHAR, dose VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR) | SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1 | ### Context: CREATE TABLE prescribes (physician VARCHAR, dose VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR) ### Question: What are the names of the physician who prescribed the highest dose? ### Answer: SELECT T1.name FROM physician AS T1 JOIN prescribes AS T2 ON T1.employeeid = T2.physician ORDER BY T2.dose DESC LIMIT 1 |
List the physicians' employee ids together with their primary affiliation departments' ids. | CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR, primaryaffiliation VARCHAR) | SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1 | ### Context: CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR, primaryaffiliation VARCHAR) ### Question: List the physicians' employee ids together with their primary affiliation departments' ids. ### Answer: SELECT physician, department FROM affiliated_with WHERE primaryaffiliation = 1 |
List the names of departments where some physicians are primarily affiliated with. | CREATE TABLE affiliated_with (department VARCHAR); CREATE TABLE department (name VARCHAR, departmentid VARCHAR) | SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1 | ### Context: CREATE TABLE affiliated_with (department VARCHAR); CREATE TABLE department (name VARCHAR, departmentid VARCHAR) ### Question: List the names of departments where some physicians are primarily affiliated with. ### Answer: SELECT DISTINCT T2.name FROM affiliated_with AS T1 JOIN department AS T2 ON T1.department = T2.departmentid WHERE PrimaryAffiliation = 1 |
What nurses are on call with block floor 1 and block code 1? Tell me their names. | CREATE TABLE on_call (nurse VARCHAR, blockfloor VARCHAR, blockcode VARCHAR) | SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1 | ### Context: CREATE TABLE on_call (nurse VARCHAR, blockfloor VARCHAR, blockcode VARCHAR) ### Question: What nurses are on call with block floor 1 and block code 1? Tell me their names. ### Answer: SELECT nurse FROM on_call WHERE blockfloor = 1 AND blockcode = 1 |
What are the highest cost, lowest cost and average cost of procedures? | CREATE TABLE procedures (cost INTEGER) | SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures | ### Context: CREATE TABLE procedures (cost INTEGER) ### Question: What are the highest cost, lowest cost and average cost of procedures? ### Answer: SELECT MAX(cost), MIN(cost), AVG(cost) FROM procedures |
List the name and cost of all procedures sorted by the cost from the highest to the lowest. | CREATE TABLE procedures (name VARCHAR, cost VARCHAR) | SELECT name, cost FROM procedures ORDER BY cost DESC | ### Context: CREATE TABLE procedures (name VARCHAR, cost VARCHAR) ### Question: List the name and cost of all procedures sorted by the cost from the highest to the lowest. ### Answer: SELECT name, cost FROM procedures ORDER BY cost DESC |
Find the three most expensive procedures. | CREATE TABLE procedures (name VARCHAR, cost VARCHAR) | SELECT name FROM procedures ORDER BY cost LIMIT 3 | ### Context: CREATE TABLE procedures (name VARCHAR, cost VARCHAR) ### Question: Find the three most expensive procedures. ### Answer: SELECT name FROM procedures ORDER BY cost LIMIT 3 |
Find the physicians who are trained in a procedure that costs more than 5000. | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR); CREATE TABLE procedures (code VARCHAR, cost INTEGER) | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000 | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR); CREATE TABLE procedures (code VARCHAR, cost INTEGER) ### Question: Find the physicians who are trained in a procedure that costs more than 5000. ### Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T3.cost > 5000 |
Find the physician who was trained in the most expensive procedure? | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR); CREATE TABLE procedures (code VARCHAR, cost VARCHAR) | SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1 | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (name VARCHAR, employeeid VARCHAR); CREATE TABLE procedures (code VARCHAR, cost VARCHAR) ### Question: Find the physician who was trained in the most expensive procedure? ### Answer: SELECT T1.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment ORDER BY T3.cost DESC LIMIT 1 |
What is the average cost of procedures that physician John Wen was trained in? | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (cost INTEGER, code VARCHAR); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR) | SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (cost INTEGER, code VARCHAR); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR) ### Question: What is the average cost of procedures that physician John Wen was trained in? ### Answer: SELECT AVG(T3.cost) FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
Find the names of procedures which physician John Wen was trained in. | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) | SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) ### Question: Find the names of procedures which physician John Wen was trained in. ### Answer: SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
Find all procedures which cost more than 1000 or which physician John Wen was trained in. | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) | SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) ### Question: Find all procedures which cost more than 1000 or which physician John Wen was trained in. ### Answer: SELECT name FROM procedures WHERE cost > 1000 UNION SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in? | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) | SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) ### Question: Find the names of all procedures which cost more than 1000 but which physician John Wen was not trained in? ### Answer: SELECT name FROM procedures WHERE cost > 1000 EXCEPT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in. | CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) | SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" | ### Context: CREATE TABLE trained_in (physician VARCHAR, treatment VARCHAR); CREATE TABLE procedures (name VARCHAR, cost INTEGER); CREATE TABLE physician (employeeid VARCHAR, name VARCHAR); CREATE TABLE procedures (name VARCHAR, code VARCHAR) ### Question: Find the names of all procedures such that the cost is less than 5000 and physician John Wen was trained in. ### Answer: SELECT name FROM procedures WHERE cost < 5000 INTERSECT SELECT T3.name FROM physician AS T1 JOIN trained_in AS T2 ON T1.employeeid = T2.physician JOIN procedures AS T3 ON T3.code = T2.treatment WHERE T1.name = "John Wen" |
Find the name of physicians who are affiliated with both Surgery and Psychiatry departments. | CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR); CREATE TABLE department (DepartmentID VARCHAR, name VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry' | ### Context: CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR); CREATE TABLE department (DepartmentID VARCHAR, name VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) ### Question: Find the name of physicians who are affiliated with both Surgery and Psychiatry departments. ### Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' INTERSECT SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Psychiatry' |
Find the name of physicians who are affiliated with Surgery or Psychiatry department. | CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR); CREATE TABLE department (DepartmentID VARCHAR, name VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) | SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry' | ### Context: CREATE TABLE affiliated_with (physician VARCHAR, department VARCHAR); CREATE TABLE department (DepartmentID VARCHAR, name VARCHAR); CREATE TABLE physician (name VARCHAR, EmployeeID VARCHAR) ### Question: Find the name of physicians who are affiliated with Surgery or Psychiatry department. ### Answer: SELECT T1.name FROM physician AS T1 JOIN affiliated_with AS T2 ON T1.EmployeeID = T2.physician JOIN department AS T3 ON T2.department = T3.DepartmentID WHERE T3.name = 'Surgery' OR T3.name = 'Psychiatry' |
Find the names of patients who are not using the medication of Procrastin-X. | CREATE TABLE Prescribes (Patient VARCHAR, Medication VARCHAR); CREATE TABLE Medication (Code VARCHAR, name VARCHAR); CREATE TABLE patient (name VARCHAR, SSN VARCHAR); CREATE TABLE patient (name VARCHAR) | SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X' | ### Context: CREATE TABLE Prescribes (Patient VARCHAR, Medication VARCHAR); CREATE TABLE Medication (Code VARCHAR, name VARCHAR); CREATE TABLE patient (name VARCHAR, SSN VARCHAR); CREATE TABLE patient (name VARCHAR) ### Question: Find the names of patients who are not using the medication of Procrastin-X. ### Answer: SELECT name FROM patient EXCEPT SELECT T1.name FROM patient AS T1 JOIN Prescribes AS T2 ON T2.Patient = T1.SSN JOIN Medication AS T3 ON T2.Medication = T3.Code WHERE T3.name = 'Procrastin-X' |
Find the number of patients who are not using the medication of Procrastin-X. | CREATE TABLE Prescribes (patient VARCHAR, Medication VARCHAR); CREATE TABLE patient (SSN VARCHAR); CREATE TABLE Medication (Code VARCHAR, name VARCHAR) | SELECT COUNT(*) FROM patient WHERE NOT SSN IN (SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X') | ### Context: CREATE TABLE Prescribes (patient VARCHAR, Medication VARCHAR); CREATE TABLE patient (SSN VARCHAR); CREATE TABLE Medication (Code VARCHAR, name VARCHAR) ### Question: Find the number of patients who are not using the medication of Procrastin-X. ### Answer: SELECT COUNT(*) FROM patient WHERE NOT SSN IN (SELECT T1.patient FROM Prescribes AS T1 JOIN Medication AS T2 ON T1.Medication = T2.Code WHERE T2.name = 'Procrastin-X') |
How many appointments are there? | CREATE TABLE appointment (Id VARCHAR) | SELECT COUNT(*) FROM appointment | ### Context: CREATE TABLE appointment (Id VARCHAR) ### Question: How many appointments are there? ### Answer: SELECT COUNT(*) FROM appointment |
Find the names of nurses who are on call. | CREATE TABLE on_call (nurse VARCHAR); CREATE TABLE nurse (name VARCHAR, EmployeeID VARCHAR) | SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse | ### Context: CREATE TABLE on_call (nurse VARCHAR); CREATE TABLE nurse (name VARCHAR, EmployeeID VARCHAR) ### Question: Find the names of nurses who are on call. ### Answer: SELECT DISTINCT T1.name FROM nurse AS T1 JOIN on_call AS T2 ON T1.EmployeeID = T2.nurse |
How many ships are there? | CREATE TABLE ship (Id VARCHAR) | SELECT COUNT(*) FROM ship | ### Context: CREATE TABLE ship (Id VARCHAR) ### Question: How many ships are there? ### Answer: SELECT COUNT(*) FROM ship |
List the name of ships in ascending order of tonnage. | CREATE TABLE ship (Name VARCHAR, Tonnage VARCHAR) | SELECT Name FROM ship ORDER BY Tonnage | ### Context: CREATE TABLE ship (Name VARCHAR, Tonnage VARCHAR) ### Question: List the name of ships in ascending order of tonnage. ### Answer: SELECT Name FROM ship ORDER BY Tonnage |
What are the type and nationality of ships? | CREATE TABLE ship (TYPE VARCHAR, Nationality VARCHAR) | SELECT TYPE, Nationality FROM ship | ### Context: CREATE TABLE ship (TYPE VARCHAR, Nationality VARCHAR) ### Question: What are the type and nationality of ships? ### Answer: SELECT TYPE, Nationality FROM ship |
List the name of ships whose nationality is not "United States". | CREATE TABLE ship (Name VARCHAR, Nationality VARCHAR) | SELECT Name FROM ship WHERE Nationality <> "United States" | ### Context: CREATE TABLE ship (Name VARCHAR, Nationality VARCHAR) ### Question: List the name of ships whose nationality is not "United States". ### Answer: SELECT Name FROM ship WHERE Nationality <> "United States" |
Show the name of ships whose nationality is either United States or United Kingdom. | CREATE TABLE ship (Name VARCHAR, Nationality VARCHAR) | SELECT Name FROM ship WHERE Nationality = "United States" OR Nationality = "United Kingdom" | ### Context: CREATE TABLE ship (Name VARCHAR, Nationality VARCHAR) ### Question: Show the name of ships whose nationality is either United States or United Kingdom. ### Answer: SELECT Name FROM ship WHERE Nationality = "United States" OR Nationality = "United Kingdom" |
What is the name of the ship with the largest tonnage? | CREATE TABLE ship (Name VARCHAR, Tonnage VARCHAR) | SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1 | ### Context: CREATE TABLE ship (Name VARCHAR, Tonnage VARCHAR) ### Question: What is the name of the ship with the largest tonnage? ### Answer: SELECT Name FROM ship ORDER BY Tonnage DESC LIMIT 1 |
Show different types of ships and the number of ships of each type. | CREATE TABLE ship (TYPE VARCHAR) | SELECT TYPE, COUNT(*) FROM ship GROUP BY TYPE | ### Context: CREATE TABLE ship (TYPE VARCHAR) ### Question: Show different types of ships and the number of ships of each type. ### Answer: SELECT TYPE, COUNT(*) FROM ship GROUP BY TYPE |
Please show the most common type of ships. | CREATE TABLE ship (TYPE VARCHAR) | SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1 | ### Context: CREATE TABLE ship (TYPE VARCHAR) ### Question: Please show the most common type of ships. ### Answer: SELECT TYPE FROM ship GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1 |
List the nations that have more than two ships. | CREATE TABLE ship (Nationality VARCHAR) | SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2 | ### Context: CREATE TABLE ship (Nationality VARCHAR) ### Question: List the nations that have more than two ships. ### Answer: SELECT Nationality FROM ship GROUP BY Nationality HAVING COUNT(*) > 2 |
Show different types of ships and the average tonnage of ships of each type. | CREATE TABLE ship (TYPE VARCHAR, Tonnage INTEGER) | SELECT TYPE, AVG(Tonnage) FROM ship GROUP BY TYPE | ### Context: CREATE TABLE ship (TYPE VARCHAR, Tonnage INTEGER) ### Question: Show different types of ships and the average tonnage of ships of each type. ### Answer: SELECT TYPE, AVG(Tonnage) FROM ship GROUP BY TYPE |
Show codes and fates of missions, and names of ships involved. | CREATE TABLE mission (Code VARCHAR, Fate VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) | SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID | ### Context: CREATE TABLE mission (Code VARCHAR, Fate VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) ### Question: Show codes and fates of missions, and names of ships involved. ### Answer: SELECT T1.Code, T1.Fate, T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID |
Show names of ships involved in a mission launched after 1928. | CREATE TABLE mission (Ship_ID VARCHAR, Launched_Year INTEGER); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) | SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928 | ### Context: CREATE TABLE mission (Ship_ID VARCHAR, Launched_Year INTEGER); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) ### Question: Show names of ships involved in a mission launched after 1928. ### Answer: SELECT T2.Name FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T1.Launched_Year > 1928 |
Show the distinct fate of missions that involve ships with nationality "United States" | CREATE TABLE mission (Fate VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Ship_ID VARCHAR, Nationality VARCHAR) | SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = "United States" | ### Context: CREATE TABLE mission (Fate VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Ship_ID VARCHAR, Nationality VARCHAR) ### Question: Show the distinct fate of missions that involve ships with nationality "United States" ### Answer: SELECT DISTINCT T1.Fate FROM mission AS T1 JOIN ship AS T2 ON T1.Ship_ID = T2.Ship_ID WHERE T2.Nationality = "United States" |
List the name of ships that are not involved in any mission | CREATE TABLE mission (Name VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) | SELECT Name FROM ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM mission) | ### Context: CREATE TABLE mission (Name VARCHAR, Ship_ID VARCHAR); CREATE TABLE ship (Name VARCHAR, Ship_ID VARCHAR) ### Question: List the name of ships that are not involved in any mission ### Answer: SELECT Name FROM ship WHERE NOT Ship_ID IN (SELECT Ship_ID FROM mission) |
Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000. | CREATE TABLE ship (TYPE VARCHAR, Tonnage INTEGER) | SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000 | ### Context: CREATE TABLE ship (TYPE VARCHAR, Tonnage INTEGER) ### Question: Show the types of ships that have both ships with tonnage larger than 6000 and ships with tonnage smaller than 4000. ### Answer: SELECT TYPE FROM ship WHERE Tonnage > 6000 INTERSECT SELECT TYPE FROM ship WHERE Tonnage < 4000 |
Find the number of students in total. | CREATE TABLE list (Id VARCHAR) | SELECT COUNT(*) FROM list | ### Context: CREATE TABLE list (Id VARCHAR) ### Question: Find the number of students in total. ### Answer: SELECT COUNT(*) FROM list |
Find the last names of students studying in room 111. | CREATE TABLE list (lastname VARCHAR, classroom VARCHAR) | SELECT lastname FROM list WHERE classroom = 111 | ### Context: CREATE TABLE list (lastname VARCHAR, classroom VARCHAR) ### Question: Find the last names of students studying in room 111. ### Answer: SELECT lastname FROM list WHERE classroom = 111 |
Find the first names of students studying in room 108. | CREATE TABLE list (firstname VARCHAR, classroom VARCHAR) | SELECT firstname FROM list WHERE classroom = 108 | ### Context: CREATE TABLE list (firstname VARCHAR, classroom VARCHAR) ### Question: Find the first names of students studying in room 108. ### Answer: SELECT firstname FROM list WHERE classroom = 108 |
What are the first names of students studying in room 107? | CREATE TABLE list (firstname VARCHAR, classroom VARCHAR) | SELECT DISTINCT firstname FROM list WHERE classroom = 107 | ### Context: CREATE TABLE list (firstname VARCHAR, classroom VARCHAR) ### Question: What are the first names of students studying in room 107? ### Answer: SELECT DISTINCT firstname FROM list WHERE classroom = 107 |
For each classroom report the grade that is taught in it. Report just the classroom number and the grade number. | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT DISTINCT classroom, grade FROM list | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: For each classroom report the grade that is taught in it. Report just the classroom number and the grade number. ### Answer: SELECT DISTINCT classroom, grade FROM list |
Which grade is studying in classroom 103? | CREATE TABLE list (grade VARCHAR, classroom VARCHAR) | SELECT DISTINCT grade FROM list WHERE classroom = 103 | ### Context: CREATE TABLE list (grade VARCHAR, classroom VARCHAR) ### Question: Which grade is studying in classroom 103? ### Answer: SELECT DISTINCT grade FROM list WHERE classroom = 103 |
Find the grade studying in room 105. | CREATE TABLE list (grade VARCHAR, classroom VARCHAR) | SELECT DISTINCT grade FROM list WHERE classroom = 105 | ### Context: CREATE TABLE list (grade VARCHAR, classroom VARCHAR) ### Question: Find the grade studying in room 105. ### Answer: SELECT DISTINCT grade FROM list WHERE classroom = 105 |
Which classrooms are used by grade 4? | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT DISTINCT classroom FROM list WHERE grade = 4 | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: Which classrooms are used by grade 4? ### Answer: SELECT DISTINCT classroom FROM list WHERE grade = 4 |
Which classrooms are used by grade 5? | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT DISTINCT classroom FROM list WHERE grade = 5 | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: Which classrooms are used by grade 5? ### Answer: SELECT DISTINCT classroom FROM list WHERE grade = 5 |
Find the last names of the teachers that teach fifth grade. | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR) | SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5 | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR) ### Question: Find the last names of the teachers that teach fifth grade. ### Answer: SELECT DISTINCT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 5 |
Find the first names of the teachers that teach first grade. | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (firstname VARCHAR, classroom VARCHAR) | SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1 | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (firstname VARCHAR, classroom VARCHAR) ### Question: Find the first names of the teachers that teach first grade. ### Answer: SELECT DISTINCT T2.firstname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE grade = 1 |
Find the first names of all the teachers that teach in classroom 110. | CREATE TABLE teachers (firstname VARCHAR, classroom VARCHAR) | SELECT firstname FROM teachers WHERE classroom = 110 | ### Context: CREATE TABLE teachers (firstname VARCHAR, classroom VARCHAR) ### Question: Find the first names of all the teachers that teach in classroom 110. ### Answer: SELECT firstname FROM teachers WHERE classroom = 110 |
Find the last names of teachers teaching in classroom 109. | CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR) | SELECT lastname FROM teachers WHERE classroom = 109 | ### Context: CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR) ### Question: Find the last names of teachers teaching in classroom 109. ### Answer: SELECT lastname FROM teachers WHERE classroom = 109 |
Report the first name and last name of all the teachers. | CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR) | SELECT DISTINCT firstname, lastname FROM teachers | ### Context: CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR) ### Question: Report the first name and last name of all the teachers. ### Answer: SELECT DISTINCT firstname, lastname FROM teachers |
Report the first name and last name of all the students. | CREATE TABLE list (firstname VARCHAR, lastname VARCHAR) | SELECT DISTINCT firstname, lastname FROM list | ### Context: CREATE TABLE list (firstname VARCHAR, lastname VARCHAR) ### Question: Report the first name and last name of all the students. ### Answer: SELECT DISTINCT firstname, lastname FROM list |
Find all students taught by OTHA MOYER. Output the first and last names of the students. | CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" | ### Context: CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find all students taught by OTHA MOYER. Output the first and last names of the students. ### Answer: SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" |
Find all students taught by MARROTTE KIRK. Output first and last names of students. | CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK" | ### Context: CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find all students taught by MARROTTE KIRK. Output first and last names of students. ### Answer: SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "MARROTTE" AND T2.lastname = "KIRK" |
Find the first and last name of all the teachers that teach EVELINA BROMLEY. | CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY" | ### Context: CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find the first and last name of all the teachers that teach EVELINA BROMLEY. ### Answer: SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "EVELINA" AND T1.lastname = "BROMLEY" |
Find the last names of all the teachers that teach GELL TAMI. | CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI" | ### Context: CREATE TABLE teachers (lastname VARCHAR, classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find the last names of all the teachers that teach GELL TAMI. ### Answer: SELECT T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "GELL" AND T1.lastname = "TAMI" |
How many students does LORIA ONDERSMA teaches? | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA" | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: How many students does LORIA ONDERSMA teaches? ### Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "LORIA" AND T2.lastname = "ONDERSMA" |
How many students does KAWA GORDON teaches? | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "KAWA" AND T2.lastname = "GORDON" | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: How many students does KAWA GORDON teaches? ### Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "KAWA" AND T2.lastname = "GORDON" |
Find the number of students taught by TARRING LEIA. | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA" | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find the number of students taught by TARRING LEIA. ### Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "TARRING" AND T2.lastname = "LEIA" |
How many teachers does the student named CHRISSY NABOZNY have? | CREATE TABLE teachers (classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY" | ### Context: CREATE TABLE teachers (classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: How many teachers does the student named CHRISSY NABOZNY have? ### Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "CHRISSY" AND T1.lastname = "NABOZNY" |
How many teachers does the student named MADLOCK RAY have? | CREATE TABLE teachers (classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "MADLOCK" AND T1.lastname = "RAY" | ### Context: CREATE TABLE teachers (classroom VARCHAR); CREATE TABLE list (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: How many teachers does the student named MADLOCK RAY have? ### Answer: SELECT COUNT(*) FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.firstname = "MADLOCK" AND T1.lastname = "RAY" |
Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names. | CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR, grade VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) | SELECT DISTINCT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" | ### Context: CREATE TABLE list (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR, grade VARCHAR); CREATE TABLE teachers (classroom VARCHAR, firstname VARCHAR, lastname VARCHAR) ### Question: Find all first-grade students who are NOT taught by OTHA MOYER. Report their first and last names. ### Answer: SELECT DISTINCT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 1 EXCEPT SELECT T1.firstname, T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T2.firstname = "OTHA" AND T2.lastname = "MOYER" |
Find the last names of the students in third grade that are not taught by COVIN JEROME. | CREATE TABLE list (lastname VARCHAR, classroom VARCHAR, grade VARCHAR); CREATE TABLE teachers (classroom VARCHAR, lastname VARCHAR, firstname VARCHAR) | SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname <> "COVIN" AND T2.lastname <> "JEROME" | ### Context: CREATE TABLE list (lastname VARCHAR, classroom VARCHAR, grade VARCHAR); CREATE TABLE teachers (classroom VARCHAR, lastname VARCHAR, firstname VARCHAR) ### Question: Find the last names of the students in third grade that are not taught by COVIN JEROME. ### Answer: SELECT DISTINCT T1.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom WHERE T1.grade = 3 AND T2.firstname <> "COVIN" AND T2.lastname <> "JEROME" |
For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade. | CREATE TABLE list (grade VARCHAR, classroom VARCHAR) | SELECT grade, COUNT(DISTINCT classroom), COUNT(*) FROM list GROUP BY grade | ### Context: CREATE TABLE list (grade VARCHAR, classroom VARCHAR) ### Question: For each grade, report the grade, the number of classrooms in which it is taught and the total number of students in the grade. ### Answer: SELECT grade, COUNT(DISTINCT classroom), COUNT(*) FROM list GROUP BY grade |
For each classroom, report the classroom number and the number of grades using it. | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT classroom, COUNT(DISTINCT grade) FROM list GROUP BY classroom | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: For each classroom, report the classroom number and the number of grades using it. ### Answer: SELECT classroom, COUNT(DISTINCT grade) FROM list GROUP BY classroom |
Which classroom has the most students? | CREATE TABLE list (classroom VARCHAR) | SELECT classroom FROM list GROUP BY classroom ORDER BY COUNT(*) DESC LIMIT 1 | ### Context: CREATE TABLE list (classroom VARCHAR) ### Question: Which classroom has the most students? ### Answer: SELECT classroom FROM list GROUP BY classroom ORDER BY COUNT(*) DESC LIMIT 1 |
Report the number of students in each classroom. | CREATE TABLE list (classroom VARCHAR) | SELECT classroom, COUNT(*) FROM list GROUP BY classroom | ### Context: CREATE TABLE list (classroom VARCHAR) ### Question: Report the number of students in each classroom. ### Answer: SELECT classroom, COUNT(*) FROM list GROUP BY classroom |
For each grade 0 classroom, report the total number of students. | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT classroom, COUNT(*) FROM list WHERE grade = "0" GROUP BY classroom | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: For each grade 0 classroom, report the total number of students. ### Answer: SELECT classroom, COUNT(*) FROM list WHERE grade = "0" GROUP BY classroom |
Report the total number of students for each fourth-grade classroom. | CREATE TABLE list (classroom VARCHAR, grade VARCHAR) | SELECT classroom, COUNT(*) FROM list WHERE grade = "4" GROUP BY classroom | ### Context: CREATE TABLE list (classroom VARCHAR, grade VARCHAR) ### Question: Report the total number of students for each fourth-grade classroom. ### Answer: SELECT classroom, COUNT(*) FROM list WHERE grade = "4" GROUP BY classroom |
Find the name of the teacher who teaches the largest number of students. | CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR) | SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROUP BY T2.firstname, T2.lastname ORDER BY COUNT(*) DESC LIMIT 1 | ### Context: CREATE TABLE list (classroom VARCHAR); CREATE TABLE teachers (firstname VARCHAR, lastname VARCHAR, classroom VARCHAR) ### Question: Find the name of the teacher who teaches the largest number of students. ### Answer: SELECT T2.firstname, T2.lastname FROM list AS T1 JOIN teachers AS T2 ON T1.classroom = T2.classroom GROUP BY T2.firstname, T2.lastname ORDER BY COUNT(*) DESC LIMIT 1 |
Find the number of students in one classroom. | CREATE TABLE list (classroom VARCHAR) | SELECT COUNT(*), classroom FROM list GROUP BY classroom | ### Context: CREATE TABLE list (classroom VARCHAR) ### Question: Find the number of students in one classroom. ### Answer: SELECT COUNT(*), classroom FROM list GROUP BY classroom |
How many companies are headquartered in the US? | CREATE TABLE company (Headquarters VARCHAR) | SELECT COUNT(*) FROM company WHERE Headquarters = 'USA' | ### Context: CREATE TABLE company (Headquarters VARCHAR) ### Question: How many companies are headquartered in the US? ### Answer: SELECT COUNT(*) FROM company WHERE Headquarters = 'USA' |
List the names of companies by ascending number of sales. | CREATE TABLE company (Name VARCHAR, Sales_in_Billion VARCHAR) | SELECT Name FROM company ORDER BY Sales_in_Billion | ### Context: CREATE TABLE company (Name VARCHAR, Sales_in_Billion VARCHAR) ### Question: List the names of companies by ascending number of sales. ### Answer: SELECT Name FROM company ORDER BY Sales_in_Billion |
What are the headquarters and industries of all companies? | CREATE TABLE company (Headquarters VARCHAR, Industry VARCHAR) | SELECT Headquarters, Industry FROM company | ### Context: CREATE TABLE company (Headquarters VARCHAR, Industry VARCHAR) ### Question: What are the headquarters and industries of all companies? ### Answer: SELECT Headquarters, Industry FROM company |
Show the names of companies in the banking or retailing industry? | CREATE TABLE company (Name VARCHAR, Industry VARCHAR) | SELECT Name FROM company WHERE Industry = "Banking" OR Industry = "Retailing" | ### Context: CREATE TABLE company (Name VARCHAR, Industry VARCHAR) ### Question: Show the names of companies in the banking or retailing industry? ### Answer: SELECT Name FROM company WHERE Industry = "Banking" OR Industry = "Retailing" |
What is the maximum and minimum market value of companies? | CREATE TABLE company (Market_Value_in_Billion INTEGER) | SELECT MAX(Market_Value_in_Billion), MIN(Market_Value_in_Billion) FROM company | ### Context: CREATE TABLE company (Market_Value_in_Billion INTEGER) ### Question: What is the maximum and minimum market value of companies? ### Answer: SELECT MAX(Market_Value_in_Billion), MIN(Market_Value_in_Billion) FROM company |
What is the headquarter of the company with the largest sales? | CREATE TABLE company (Headquarters VARCHAR, Sales_in_Billion VARCHAR) | SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1 | ### Context: CREATE TABLE company (Headquarters VARCHAR, Sales_in_Billion VARCHAR) ### Question: What is the headquarter of the company with the largest sales? ### Answer: SELECT Headquarters FROM company ORDER BY Sales_in_Billion DESC LIMIT 1 |
Show the different headquarters and number of companies at each headquarter. | CREATE TABLE company (Headquarters VARCHAR) | SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters | ### Context: CREATE TABLE company (Headquarters VARCHAR) ### Question: Show the different headquarters and number of companies at each headquarter. ### Answer: SELECT Headquarters, COUNT(*) FROM company GROUP BY Headquarters |
Show the most common headquarter for companies. | CREATE TABLE company (Headquarters VARCHAR) | SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1 | ### Context: CREATE TABLE company (Headquarters VARCHAR) ### Question: Show the most common headquarter for companies. ### Answer: SELECT Headquarters FROM company GROUP BY Headquarters ORDER BY COUNT(*) DESC LIMIT 1 |
Show the headquarters that have at least two companies. | CREATE TABLE company (Headquarters VARCHAR) | SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2 | ### Context: CREATE TABLE company (Headquarters VARCHAR) ### Question: Show the headquarters that have at least two companies. ### Answer: SELECT Headquarters FROM company GROUP BY Headquarters HAVING COUNT(*) >= 2 |
Show the headquarters that have both companies in banking industry and companies in oil and gas industry. | CREATE TABLE company (Headquarters VARCHAR, Industry VARCHAR) | SELECT Headquarters FROM company WHERE Industry = "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry = "Oil and gas" | ### Context: CREATE TABLE company (Headquarters VARCHAR, Industry VARCHAR) ### Question: Show the headquarters that have both companies in banking industry and companies in oil and gas industry. ### Answer: SELECT Headquarters FROM company WHERE Industry = "Banking" INTERSECT SELECT Headquarters FROM company WHERE Industry = "Oil and gas" |
Show the names of companies and of employees. | CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) | SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID | ### Context: CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ### Question: Show the names of companies and of employees. ### Answer: SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID |
Show names of companies and that of employees in descending order of number of years working for that employee. | CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR, Year_working VARCHAR) | SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID ORDER BY T1.Year_working | ### Context: CREATE TABLE people (Name VARCHAR, People_ID VARCHAR); CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR, Year_working VARCHAR) ### Question: Show names of companies and that of employees in descending order of number of years working for that employee. ### Answer: SELECT T3.Name, T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID ORDER BY T1.Year_working |
Show the names of employees that work for companies with sales bigger than 200. | CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR); CREATE TABLE company (Company_ID VARCHAR, Sales_in_Billion INTEGER); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) | SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID WHERE T3.Sales_in_Billion > 200 | ### Context: CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR); CREATE TABLE company (Company_ID VARCHAR, Sales_in_Billion INTEGER); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ### Question: Show the names of employees that work for companies with sales bigger than 200. ### Answer: SELECT T2.Name FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID WHERE T3.Sales_in_Billion > 200 |
Show the names of companies and the number of employees they have | CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE people (People_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR) | SELECT T3.Name, COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID GROUP BY T3.Name | ### Context: CREATE TABLE company (Name VARCHAR, Company_ID VARCHAR); CREATE TABLE people (People_ID VARCHAR); CREATE TABLE employment (People_ID VARCHAR, Company_ID VARCHAR) ### Question: Show the names of companies and the number of employees they have ### Answer: SELECT T3.Name, COUNT(*) FROM employment AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID JOIN company AS T3 ON T1.Company_ID = T3.Company_ID GROUP BY T3.Name |
List the names of people that are not employed by any company | CREATE TABLE employment (Name VARCHAR, People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) | SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM employment) | ### Context: CREATE TABLE employment (Name VARCHAR, People_ID VARCHAR); CREATE TABLE people (Name VARCHAR, People_ID VARCHAR) ### Question: List the names of people that are not employed by any company ### Answer: SELECT Name FROM people WHERE NOT People_ID IN (SELECT People_ID FROM employment) |
list the names of the companies with more than 200 sales in the descending order of sales and profits. | CREATE TABLE company (name VARCHAR, Sales_in_Billion INTEGER, Profits_in_Billion VARCHAR) | SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion, Profits_in_Billion DESC | ### Context: CREATE TABLE company (name VARCHAR, Sales_in_Billion INTEGER, Profits_in_Billion VARCHAR) ### Question: list the names of the companies with more than 200 sales in the descending order of sales and profits. ### Answer: SELECT name FROM company WHERE Sales_in_Billion > 200 ORDER BY Sales_in_Billion, Profits_in_Billion DESC |
How many film are there? | CREATE TABLE film (Id VARCHAR) | SELECT COUNT(*) FROM film | ### Context: CREATE TABLE film (Id VARCHAR) ### Question: How many film are there? ### Answer: SELECT COUNT(*) FROM film |
List the distinct director of all films. | CREATE TABLE film (Director VARCHAR) | SELECT DISTINCT Director FROM film | ### Context: CREATE TABLE film (Director VARCHAR) ### Question: List the distinct director of all films. ### Answer: SELECT DISTINCT Director FROM film |
What is the average ticket sales gross in dollars of films? | CREATE TABLE film (Gross_in_dollar INTEGER) | SELECT AVG(Gross_in_dollar) FROM film | ### Context: CREATE TABLE film (Gross_in_dollar INTEGER) ### Question: What is the average ticket sales gross in dollars of films? ### Answer: SELECT AVG(Gross_in_dollar) FROM film |
What are the low and high estimates of film markets? | CREATE TABLE film_market_estimation (Low_Estimate VARCHAR, High_Estimate VARCHAR) | SELECT Low_Estimate, High_Estimate FROM film_market_estimation | ### Context: CREATE TABLE film_market_estimation (Low_Estimate VARCHAR, High_Estimate VARCHAR) ### Question: What are the low and high estimates of film markets? ### Answer: SELECT Low_Estimate, High_Estimate FROM film_market_estimation |
What are the types of film market estimations in year 1995? | CREATE TABLE film_market_estimation (TYPE VARCHAR, YEAR VARCHAR) | SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995 | ### Context: CREATE TABLE film_market_estimation (TYPE VARCHAR, YEAR VARCHAR) ### Question: What are the types of film market estimations in year 1995? ### Answer: SELECT TYPE FROM film_market_estimation WHERE YEAR = 1995 |
What are the maximum and minimum number of cities in all markets. | CREATE TABLE market (Number_cities INTEGER) | SELECT MAX(Number_cities), MIN(Number_cities) FROM market | ### Context: CREATE TABLE market (Number_cities INTEGER) ### Question: What are the maximum and minimum number of cities in all markets. ### Answer: SELECT MAX(Number_cities), MIN(Number_cities) FROM market |
How many markets have number of cities smaller than 300? | CREATE TABLE market (Number_cities INTEGER) | SELECT COUNT(*) FROM market WHERE Number_cities < 300 | ### Context: CREATE TABLE market (Number_cities INTEGER) ### Question: How many markets have number of cities smaller than 300? ### Answer: SELECT COUNT(*) FROM market WHERE Number_cities < 300 |
List all countries of markets in ascending alphabetical order. | CREATE TABLE market (Country VARCHAR) | SELECT Country FROM market ORDER BY Country | ### Context: CREATE TABLE market (Country VARCHAR) ### Question: List all countries of markets in ascending alphabetical order. ### Answer: SELECT Country FROM market ORDER BY Country |
List all countries of markets in descending order of number of cities. | CREATE TABLE market (Country VARCHAR, Number_cities VARCHAR) | SELECT Country FROM market ORDER BY Number_cities DESC | ### Context: CREATE TABLE market (Country VARCHAR, Number_cities VARCHAR) ### Question: List all countries of markets in descending order of number of cities. ### Answer: SELECT Country FROM market ORDER BY Number_cities DESC |
Subsets and Splits