db_id
stringclasses
140 values
messages
listlengths
2
2
flight_1
[ { "content": "Translate the following question to SQL: What are the numbers of the shortest flights?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the average distance and average price for flights from Los Angeles.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT avg(distance) , avg(price) FROM Flight WHERE origin = \"Los Angeles\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the average distance and price for all flights from LA?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT avg(distance) , avg(price) FROM Flight WHERE origin = \"Los Angeles\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show all origins and the number of flights from each origin.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT origin , count(*) FROM Flight GROUP BY origin", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: For each origin, how many flights came from there?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT origin , count(*) FROM Flight GROUP BY origin", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show all destinations and the number of flights to each destination.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT destination , count(*) FROM Flight GROUP BY destination", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the destinations and number of flights to each one?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT destination , count(*) FROM Flight GROUP BY destination", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Which origin has most number of flights?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What place has the most flights coming from there?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Which destination has least number of flights?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What destination has the fewest number of flights?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the aircraft name for the flight with number 99\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the name of the aircraft that was on flight number 99?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show all flight numbers with aircraft Airbus A340-300.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = \"Airbus A340-300\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the flight numbers for the aircraft Airbus A340-300?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = \"Airbus A340-300\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show aircraft names and number of flights for each aircraft.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the name of each aircraft and how many flights does each one complete?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show names for all aircraft with at least two flights.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names for all aircrafts with at least 2 flights?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: How many employees have certificate.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT eid) FROM Certificate", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the count of distinct employees with certificates?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT eid) FROM Certificate", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show ids for all employees who don't have a certificate.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the ids of all employees that don't have certificates?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show names for all aircrafts of which John Williams has certificates.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names of all aircrafts that John Williams have certificates to be able to fly?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show names for all employees who have certificate of Boeing 737-800.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names of all employees who have a certificate to fly Boeing 737-800?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show names for all employees who do not have certificate of Boeing 737-800.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names of all employees who are not certified to fly Boeing 737-800s?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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\"", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show the name of aircraft which fewest people have its certificate.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What are the names of the aircraft that the least people are certified to fly?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the name and distance of every aircraft that can cover a distance of more than 5000 and which at least 5 people can fly?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: what is the salary and name of the employee who has the most number of aircraft certificates?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the salaray and name of the employee that is certified to fly the most planes?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
flight_1
[ { "content": "Translate the following question to SQL: What is the salaray and name of the employee with the most certificates to fly planes more than 5000?\n\nSchema: CREATE TABLE flight (\n flno number(4,0) PRIMARY KEY,\n origin varchar2(20),\n destination varchar2(20),\n distance number(6,0),\n departure_date date,\n arrival_date date,\n price number(7,2),\n aid number(9,0),\n UNIQUE (flno),\n FOREIGN KEY (aid) REFERENCES aircraft(aid)\n);\n\nCREATE TABLE aircraft (\n aid number(9,0) PRIMARY KEY,\n name varchar2(30),\n distance number(6,0),\n UNIQUE (aid)\n);\n\nCREATE TABLE employee (\n eid number(9,0) PRIMARY KEY,\n name varchar2(30),\n salary number(10,2),\n UNIQUE (eid)\n);\n\nCREATE TABLE certificate (\n eid number(9,0) PRIMARY KEY,\n aid number(9,0) PRIMARY KEY,\n PRIMARY KEY (eid, aid),\n UNIQUE (eid, aid),\n FOREIGN KEY (aid) REFERENCES aircraft(aid),\n FOREIGN KEY (eid) REFERENCES employee(eid)\n);", "role": "user" }, { "content": "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", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many allergies are there?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT allergy) FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many allergy entries are there?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT allergy) FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many different allergy types exist?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT allergytype) FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many distinct allergies are there?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT allergytype) FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergy types.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT allergytype FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the different allergy types?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT allergytype FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergies and their types.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergy , allergytype FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the allergies and their types?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergy , allergytype FROM Allergy_type", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergies with type food.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = \"food\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are all the different food allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = \"food\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the type of allergy Cat?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type WHERE allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is allergy type of a cat allergy?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type WHERE allergy = \"Cat\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many allergies have type animal?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Allergy_type WHERE allergytype = \"animal\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many animal type allergies exist?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Allergy_type WHERE allergytype = \"animal\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all allergy types and the number of allergies in each type.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the allergy types and how many allergies correspond to each one?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy type has most number of allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy type is most common?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy type has least number of allergies?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which allergy type is the least common?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are there?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the total number of students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show first name and last name for all students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Fname , Lname FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the full names of all students\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Fname , Lname FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many different advisors are listed?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT advisor) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many advisors are there?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(DISTINCT advisor) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all majors.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT Major FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the different majors?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT Major FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all cities where students live.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT city_code FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What cities do students live in?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT DISTINCT city_code FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show first name, last name, age for all female students. Their sex is F.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the full names and ages for all female students whose sex is F?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show student ids for all male students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE Sex = 'M'", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the student ids for all male students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE Sex = 'M'", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are age 18?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE age = 18", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are 18 years old?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE age = 18", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all student ids who are older than 20.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE age > 20", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the student ids for students over 20 years old?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE age > 20", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which city does the student whose last name is \"Kim\" live in?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT city_code FROM Student WHERE LName = \"Kim\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Give the city that the student whose family name is Kim lives in.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT city_code FROM Student WHERE LName = \"Kim\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Who is the advisor of student with ID 1004?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Advisor FROM Student WHERE StuID = 1004", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Who advises student 1004?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT Advisor FROM Student WHERE StuID = 1004", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students live in HKG or CHI?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE city_code = \"HKG\" OR city_code = \"CHI\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Give the number of students living in either HKG or CHI.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT count(*) FROM Student WHERE city_code = \"HKG\" OR city_code = \"CHI\"", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show the minimum, average, and maximum age of all students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT min(age) , avg(age) , max(age) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the minimum, mean, and maximum age across all students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT min(age) , avg(age) , max(age) FROM Student", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the last name of the youngest student?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Provide the last name of the youngest student.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show the student id of the oldest student.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What student id corresponds to the oldest student?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all majors and corresponding number of students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT major , count(*) FROM Student GROUP BY major", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students are there for each major?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT major , count(*) FROM Student GROUP BY major", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Which major has most number of students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What is the largest major?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all ages and corresponding number of students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT age , count(*) FROM Student GROUP BY age", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How old is each student and how many students are each age?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT age , count(*) FROM Student GROUP BY age", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show the average age for male and female students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT avg(age) , sex FROM Student GROUP BY sex", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: What are the average ages for male and female students?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT avg(age) , sex FROM Student GROUP BY sex", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all cities and corresponding number of students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT city_code , count(*) FROM Student GROUP BY city_code", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: How many students live in each city?\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT city_code , count(*) FROM Student GROUP BY city_code", "role": "assistant" } ]
allergy_1
[ { "content": "Translate the following question to SQL: Show all advisors and corresponding number of students.\n\nSchema: CREATE TABLE Allergy_Type (\n Allergy VARCHAR(20) PRIMARY KEY,\n AllergyType VARCHAR(20),\n UNIQUE (Allergy)\n);\n\nCREATE TABLE Has_Allergy (\n StuID INTEGER,\n Allergy VARCHAR(20),\n FOREIGN KEY (Allergy) REFERENCES Allergy_Type(Allergy),\n FOREIGN KEY (StuID) REFERENCES Student(StuID)\n);\n\nCREATE TABLE Student (\n StuID INTEGER PRIMARY KEY,\n LName VARCHAR(12),\n Fname VARCHAR(12),\n Age INTEGER,\n Sex VARCHAR(1),\n Major INTEGER,\n Advisor INTEGER,\n city_code VARCHAR(3)\n);", "role": "user" }, { "content": "SELECT advisor , count(*) FROM Student GROUP BY advisor", "role": "assistant" } ]