input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT origin , count(*) FROM Flight GROUP BY origin;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT origin , count(*) FROM Flight GROUP BY origin;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT destination , count(*) FROM Flight GROUP BY destination;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT destination , count(*) FROM Flight GROUP BY destination;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT count(DISTINCT eid) FROM Certificate;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT count(DISTINCT eid) FROM Certificate;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = "John Williams";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T3.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T1.name = "John Williams";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800" INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Airbus A340-300"...
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800" INTERSECT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Airbus A340-300"...
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT name FROM Employee EXCEPT SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.name = "Boeing 737-800";
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid GROUP BY T1.aid ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T2.name FROM Certificate AS T1 JOIN Aircraft AS T2 ON T2.aid = T1.aid WHERE T2.distance > 5000 GROUP BY T1.aid ORDER BY count(*) >= 5;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name , T1.salary FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1;
Tables: flight, aircraft, employee, certificate Columns: flight.flno, flight.origin, flight.destination, flight.distance, flight.departure_date, flight.arrival_date, flight.price, flight.aid, aircraft.aid, aircraft.name, aircraft.distance, employee.eid, employee.name, employee.salary, certificate.eid, certificate.aid Q...
SELECT T1.name FROM Employee AS T1 JOIN Certificate AS T2 ON T1.eid = T2.eid JOIN Aircraft AS T3 ON T3.aid = T2.aid WHERE T3.distance > 5000 GROUP BY T1.eid ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many allergies are there? [/INST]
SELECT count(DISTINCT allergy) FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many allergy entries are there? [/INST]
SELECT count(DISTINCT allergy) FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many different allergy types exist? [/INST]
SELECT count(DISTINCT allergytype) FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many distinct allergies are there? [/INST]
SELECT count(DISTINCT allergytype) FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergy types. [/INST]
SELECT DISTINCT allergytype FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the different allergy types? [/INST]
SELECT DISTINCT allergytype FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergies and their types. [/INST]
SELECT allergy , allergytype FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the allergies and their types? [/INST]
SELECT allergy , allergytype FROM Allergy_type;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergies with type food. [/INST]
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are all the different food allergies? [/INST...
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the type of allergy Cat? [/INST]
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is allergy type of a cat allergy? [/INST]
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many allergies have type animal? [/INST]
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many animal type allergies exist? [/INST]
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all allergy types and the number of allergie...
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the allergy types and how many allergies...
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy type has most number of allergies? ...
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy type is most common? [/INST]
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy type has least number of allergies?...
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which allergy type is the least common? [/INST]
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are there? [/INST]
SELECT count(*) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the total number of students? [/INST]
SELECT count(*) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show first name and last name for all students. [...
SELECT Fname , Lname FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the full names of all students [/INST]
SELECT Fname , Lname FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many different advisors are listed? [/INST]
SELECT count(DISTINCT advisor) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many advisors are there? [/INST]
SELECT count(DISTINCT advisor) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all majors. [/INST]
SELECT DISTINCT Major FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the different majors? [/INST]
SELECT DISTINCT Major FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all cities where students live. [/INST]
SELECT DISTINCT city_code FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What cities do students live in? [/INST]
SELECT DISTINCT city_code FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show first name, last name, age for all female st...
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F';
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the full names and ages for all female s...
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F';
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show student ids for all male students. [/INST]
SELECT StuID FROM Student WHERE Sex = 'M';
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the student ids for all male students? [...
SELECT StuID FROM Student WHERE Sex = 'M';
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are age 18? [/INST]
SELECT count(*) FROM Student WHERE age = 18;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are 18 years old? [/INST]
SELECT count(*) FROM Student WHERE age = 18;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all student ids who are older than 20. [/INS...
SELECT StuID FROM Student WHERE age > 20;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the student ids for students over 20 yea...
SELECT StuID FROM Student WHERE age > 20;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which city does the student whose last name is "K...
SELECT city_code FROM Student WHERE LName = "Kim";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Give the city that the student whose family name ...
SELECT city_code FROM Student WHERE LName = "Kim";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Who is the advisor of student with ID 1004? [/INS...
SELECT Advisor FROM Student WHERE StuID = 1004;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Who advises student 1004? [/INST]
SELECT Advisor FROM Student WHERE StuID = 1004;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students live in HKG or CHI? [/INST]
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Give the number of students living in either HKG ...
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI";
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show the minimum, average, and maximum age of all...
SELECT min(age) , avg(age) , max(age) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the minimum, mean, and maximum age across...
SELECT min(age) , avg(age) , max(age) FROM Student;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the last name of the youngest student? [/...
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student);
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Provide the last name of the youngest student. [/...
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student);
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show the student id of the oldest student. [/INST...
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student);
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What student id corresponds to the oldest student...
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student);
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all majors and corresponding number of stude...
SELECT major , count(*) FROM Student GROUP BY major;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students are there for each major? [/INS...
SELECT major , count(*) FROM Student GROUP BY major;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Which major has most number of students? [/INST]
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What is the largest major? [/INST]
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all ages and corresponding number of student...
SELECT age , count(*) FROM Student GROUP BY age;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How old is each student and how many students are...
SELECT age , count(*) FROM Student GROUP BY age;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show the average age for male and female students...
SELECT avg(age) , sex FROM Student GROUP BY sex;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: What are the average ages for male and female stu...
SELECT avg(age) , sex FROM Student GROUP BY sex;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all cities and corresponding number of stude...
SELECT city_code , count(*) FROM Student GROUP BY city_code;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: How many students live in each city? [/INST]
SELECT city_code , count(*) FROM Student GROUP BY city_code;
Tables: Allergy_Type, Has_Allergy, Student Columns: Allergy_Type.Allergy, Allergy_Type.AllergyType, Has_Allergy.StuID, Has_Allergy.Allergy, Student.StuID, Student.LName, Student.Fname, Student.Age, Student.Sex, Student.Major, Student.Advisor, Student.city_code Question: Show all advisors and corresponding number of stu...
SELECT advisor , count(*) FROM Student GROUP BY advisor;