answer
stringlengths 18
557
| context
stringlengths 27
489
| question
stringlengths 12
244
| text
stringlengths 275
1.7k
|
---|---|---|---|
SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1 | CREATE TABLE Catalogs (date_of_latest_revision VARCHAR) | Find the dates on which more than one revisions were made. | <s>[INST] Given the following SQL query and context: Query: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1 Context: CREATE TABLE Catalogs (date_of_latest_revision VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the dates on which more than one revisions were made. The answer to your question is: SELECT date_of_latest_revision FROM Catalogs GROUP BY date_of_latest_revision HAVING COUNT(*) > 1. [/s> |
SELECT COUNT(*) FROM catalog_contents | CREATE TABLE catalog_contents (Id VARCHAR) | How many products are there in the records? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM catalog_contents Context: CREATE TABLE catalog_contents (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many products are there in the records? The answer to your question is: SELECT COUNT(*) FROM catalog_contents. [/s> |
SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8 | CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, next_entry_id INTEGER) | Name all the products with next entry ID greater than 8. | <s>[INST] Given the following SQL query and context: Query: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8 Context: CREATE TABLE catalog_contents (catalog_entry_name VARCHAR, next_entry_id INTEGER) [/INST] Based on the provided SQL query and context, your question is: Name all the products with next entry ID greater than 8. The answer to your question is: SELECT catalog_entry_name FROM catalog_contents WHERE next_entry_id > 8. [/s> |
SELECT COUNT(*) FROM Aircraft | CREATE TABLE Aircraft (Id VARCHAR) | How many aircrafts do we have? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Aircraft Context: CREATE TABLE Aircraft (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many aircrafts do we have? The answer to your question is: SELECT COUNT(*) FROM Aircraft. [/s> |
SELECT name, distance FROM Aircraft | CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) | Show name and distance for all aircrafts. | <s>[INST] Given the following SQL query and context: Query: SELECT name, distance FROM Aircraft Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show name and distance for all aircrafts. The answer to your question is: SELECT name, distance FROM Aircraft. [/s> |
SELECT aid FROM Aircraft WHERE distance > 1000 | CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER) | Show ids for all aircrafts with more than 1000 distance. | <s>[INST] Given the following SQL query and context: Query: SELECT aid FROM Aircraft WHERE distance > 1000 Context: CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show ids for all aircrafts with more than 1000 distance. The answer to your question is: SELECT aid FROM Aircraft WHERE distance > 1000. [/s> |
SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000 | CREATE TABLE Aircraft (distance INTEGER) | How many aircrafts have distance between 1000 and 5000? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000 Context: CREATE TABLE Aircraft (distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: How many aircrafts have distance between 1000 and 5000? The answer to your question is: SELECT COUNT(*) FROM Aircraft WHERE distance BETWEEN 1000 AND 5000. [/s> |
SELECT name, distance FROM Aircraft WHERE aid = 12 | CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR, aid VARCHAR) | What is the name and distance for aircraft with id 12? | <s>[INST] Given the following SQL query and context: Query: SELECT name, distance FROM Aircraft WHERE aid = 12 Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR, aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the name and distance for aircraft with id 12? The answer to your question is: SELECT name, distance FROM Aircraft WHERE aid = 12. [/s> |
SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft | CREATE TABLE Aircraft (distance INTEGER) | What is the minimum, average, and maximum distance of all aircrafts. | <s>[INST] Given the following SQL query and context: Query: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft Context: CREATE TABLE Aircraft (distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the minimum, average, and maximum distance of all aircrafts. The answer to your question is: SELECT MIN(distance), AVG(distance), MAX(distance) FROM Aircraft. [/s> |
SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1 | CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR, distance VARCHAR) | Show the id and name of the aircraft with the maximum distance. | <s>[INST] Given the following SQL query and context: Query: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1 Context: CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR, distance VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the id and name of the aircraft with the maximum distance. The answer to your question is: SELECT aid, name FROM Aircraft ORDER BY distance DESC LIMIT 1. [/s> |
SELECT name FROM Aircraft ORDER BY distance LIMIT 3 | CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) | Show the name of aircrafts with top three lowest distances. | <s>[INST] Given the following SQL query and context: Query: SELECT name FROM Aircraft ORDER BY distance LIMIT 3 Context: CREATE TABLE Aircraft (name VARCHAR, distance VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the name of aircrafts with top three lowest distances. The answer to your question is: SELECT name FROM Aircraft ORDER BY distance LIMIT 3. [/s> |
SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft) | CREATE TABLE Aircraft (name VARCHAR, distance INTEGER) | Show names for all aircrafts with distances more than the average. | <s>[INST] Given the following SQL query and context: Query: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft) Context: CREATE TABLE Aircraft (name VARCHAR, distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show names for all aircrafts with distances more than the average. The answer to your question is: SELECT name FROM Aircraft WHERE distance > (SELECT AVG(distance) FROM Aircraft). [/s> |
SELECT COUNT(*) FROM Employee | CREATE TABLE Employee (Id VARCHAR) | How many employees do we have? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Employee Context: CREATE TABLE Employee (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many employees do we have? The answer to your question is: SELECT COUNT(*) FROM Employee. [/s> |
SELECT name, salary FROM Employee ORDER BY salary | CREATE TABLE Employee (name VARCHAR, salary VARCHAR) | Show name and salary for all employees sorted by salary. | <s>[INST] Given the following SQL query and context: Query: SELECT name, salary FROM Employee ORDER BY salary Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show name and salary for all employees sorted by salary. The answer to your question is: SELECT name, salary FROM Employee ORDER BY salary. [/s> |
SELECT eid FROM Employee WHERE salary > 100000 | CREATE TABLE Employee (eid VARCHAR, salary INTEGER) | Show ids for all employees with at least 100000 salary. | <s>[INST] Given the following SQL query and context: Query: SELECT eid FROM Employee WHERE salary > 100000 Context: CREATE TABLE Employee (eid VARCHAR, salary INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show ids for all employees with at least 100000 salary. The answer to your question is: SELECT eid FROM Employee WHERE salary > 100000. [/s> |
SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000 | CREATE TABLE Employee (salary INTEGER) | How many employees have salary between 100000 and 200000? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000 Context: CREATE TABLE Employee (salary INTEGER) [/INST] Based on the provided SQL query and context, your question is: How many employees have salary between 100000 and 200000? The answer to your question is: SELECT COUNT(*) FROM Employee WHERE salary BETWEEN 100000 AND 200000. [/s> |
SELECT name, salary FROM Employee WHERE eid = 242518965 | CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) | What is the name and salary for employee with id 242518965? | <s>[INST] Given the following SQL query and context: Query: SELECT name, salary FROM Employee WHERE eid = 242518965 Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the name and salary for employee with id 242518965? The answer to your question is: SELECT name, salary FROM Employee WHERE eid = 242518965. [/s> |
SELECT AVG(salary), MAX(salary) FROM Employee | CREATE TABLE Employee (salary INTEGER) | What is average and maximum salary of all employees. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(salary), MAX(salary) FROM Employee Context: CREATE TABLE Employee (salary INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is average and maximum salary of all employees. The answer to your question is: SELECT AVG(salary), MAX(salary) FROM Employee. [/s> |
SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1 | CREATE TABLE Employee (eid VARCHAR, name VARCHAR, salary VARCHAR) | Show the id and name of the employee with maximum salary. | <s>[INST] Given the following SQL query and context: Query: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1 Context: CREATE TABLE Employee (eid VARCHAR, name VARCHAR, salary VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the id and name of the employee with maximum salary. The answer to your question is: SELECT eid, name FROM Employee ORDER BY salary DESC LIMIT 1. [/s> |
SELECT name FROM Employee ORDER BY salary LIMIT 3 | CREATE TABLE Employee (name VARCHAR, salary VARCHAR) | Show the name of employees with three lowest salaries. | <s>[INST] Given the following SQL query and context: Query: SELECT name FROM Employee ORDER BY salary LIMIT 3 Context: CREATE TABLE Employee (name VARCHAR, salary VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the name of employees with three lowest salaries. The answer to your question is: SELECT name FROM Employee ORDER BY salary LIMIT 3. [/s> |
SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee) | CREATE TABLE Employee (name VARCHAR, salary INTEGER) | Show names for all employees with salary more than the average. | <s>[INST] Given the following SQL query and context: Query: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee) Context: CREATE TABLE Employee (name VARCHAR, salary INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show names for all employees with salary more than the average. The answer to your question is: SELECT name FROM Employee WHERE salary > (SELECT AVG(salary) FROM Employee). [/s> |
SELECT eid, salary FROM Employee WHERE name = 'Mark Young' | CREATE TABLE Employee (eid VARCHAR, salary VARCHAR, name VARCHAR) | Show the id and salary of Mark Young. | <s>[INST] Given the following SQL query and context: Query: SELECT eid, salary FROM Employee WHERE name = 'Mark Young' Context: CREATE TABLE Employee (eid VARCHAR, salary VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the id and salary of Mark Young. The answer to your question is: SELECT eid, salary FROM Employee WHERE name = 'Mark Young'. [/s> |
SELECT COUNT(*) FROM Flight | CREATE TABLE Flight (Id VARCHAR) | How many flights do we have? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Flight Context: CREATE TABLE Flight (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many flights do we have? The answer to your question is: SELECT COUNT(*) FROM Flight. [/s> |
SELECT flno, origin, destination FROM Flight ORDER BY origin | CREATE TABLE Flight (flno VARCHAR, origin VARCHAR, destination VARCHAR) | Show flight number, origin, destination of all flights in the alphabetical order of the departure cities. | <s>[INST] Given the following SQL query and context: Query: SELECT flno, origin, destination FROM Flight ORDER BY origin Context: CREATE TABLE Flight (flno VARCHAR, origin VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show flight number, origin, destination of all flights in the alphabetical order of the departure cities. The answer to your question is: SELECT flno, origin, destination FROM Flight ORDER BY origin. [/s> |
SELECT flno FROM Flight WHERE origin = "Los Angeles" | CREATE TABLE Flight (flno VARCHAR, origin VARCHAR) | Show all flight number from Los Angeles. | <s>[INST] Given the following SQL query and context: Query: SELECT flno FROM Flight WHERE origin = "Los Angeles" Context: CREATE TABLE Flight (flno VARCHAR, origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all flight number from Los Angeles. The answer to your question is: SELECT flno FROM Flight WHERE origin = "Los Angeles". [/s> |
SELECT origin FROM Flight WHERE destination = "Honolulu" | CREATE TABLE Flight (origin VARCHAR, destination VARCHAR) | Show origins of all flights with destination Honolulu. | <s>[INST] Given the following SQL query and context: Query: SELECT origin FROM Flight WHERE destination = "Honolulu" Context: CREATE TABLE Flight (origin VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show origins of all flights with destination Honolulu. The answer to your question is: SELECT origin FROM Flight WHERE destination = "Honolulu". [/s> |
SELECT departure_date, arrival_date FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE Flight (departure_date VARCHAR, arrival_date VARCHAR, origin VARCHAR, destination VARCHAR) | Show me the departure date and arrival date for all flights from Los Angeles to Honolulu. | <s>[INST] Given the following SQL query and context: Query: SELECT departure_date, arrival_date FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" Context: CREATE TABLE Flight (departure_date VARCHAR, arrival_date VARCHAR, origin VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show me the departure date and arrival date for all flights from Los Angeles to Honolulu. The answer to your question is: SELECT departure_date, arrival_date FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu". [/s> |
SELECT flno FROM Flight WHERE distance > 2000 | CREATE TABLE Flight (flno VARCHAR, distance INTEGER) | Show flight number for all flights with more than 2000 distance. | <s>[INST] Given the following SQL query and context: Query: SELECT flno FROM Flight WHERE distance > 2000 Context: CREATE TABLE Flight (flno VARCHAR, distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show flight number for all flights with more than 2000 distance. The answer to your question is: SELECT flno FROM Flight WHERE distance > 2000. [/s> |
SELECT AVG(price) FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" | CREATE TABLE Flight (price INTEGER, origin VARCHAR, destination VARCHAR) | What is the average price for flights from Los Angeles to Honolulu. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(price) FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu" Context: CREATE TABLE Flight (price INTEGER, origin VARCHAR, destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the average price for flights from Los Angeles to Honolulu. The answer to your question is: SELECT AVG(price) FROM Flight WHERE origin = "Los Angeles" AND destination = "Honolulu". [/s> |
SELECT origin, destination FROM Flight WHERE price > 300 | CREATE TABLE Flight (origin VARCHAR, destination VARCHAR, price INTEGER) | Show origin and destination for flights with price higher than 300. | <s>[INST] Given the following SQL query and context: Query: SELECT origin, destination FROM Flight WHERE price > 300 Context: CREATE TABLE Flight (origin VARCHAR, destination VARCHAR, price INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show origin and destination for flights with price higher than 300. The answer to your question is: SELECT origin, destination FROM Flight WHERE price > 300. [/s> |
SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1 | CREATE TABLE Flight (flno VARCHAR, distance VARCHAR, price VARCHAR) | Show the flight number and distance of the flight with maximum price. | <s>[INST] Given the following SQL query and context: Query: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1 Context: CREATE TABLE Flight (flno VARCHAR, distance VARCHAR, price VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the flight number and distance of the flight with maximum price. The answer to your question is: SELECT flno, distance FROM Flight ORDER BY price DESC LIMIT 1. [/s> |
SELECT flno FROM Flight ORDER BY distance LIMIT 3 | CREATE TABLE Flight (flno VARCHAR, distance VARCHAR) | Show the flight number of flights with three lowest distances. | <s>[INST] Given the following SQL query and context: Query: SELECT flno FROM Flight ORDER BY distance LIMIT 3 Context: CREATE TABLE Flight (flno VARCHAR, distance VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the flight number of flights with three lowest distances. The answer to your question is: SELECT flno FROM Flight ORDER BY distance LIMIT 3. [/s> |
SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = "Los Angeles" | CREATE TABLE Flight (distance INTEGER, price INTEGER, origin VARCHAR) | What is the average distance and average price for flights from Los Angeles. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = "Los Angeles" Context: CREATE TABLE Flight (distance INTEGER, price INTEGER, origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the average distance and average price for flights from Los Angeles. The answer to your question is: SELECT AVG(distance), AVG(price) FROM Flight WHERE origin = "Los Angeles". [/s> |
SELECT origin, COUNT(*) FROM Flight GROUP BY origin | CREATE TABLE Flight (origin VARCHAR) | Show all origins and the number of flights from each origin. | <s>[INST] Given the following SQL query and context: Query: SELECT origin, COUNT(*) FROM Flight GROUP BY origin Context: CREATE TABLE Flight (origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all origins and the number of flights from each origin. The answer to your question is: SELECT origin, COUNT(*) FROM Flight GROUP BY origin. [/s> |
SELECT destination, COUNT(*) FROM Flight GROUP BY destination | CREATE TABLE Flight (destination VARCHAR) | Show all destinations and the number of flights to each destination. | <s>[INST] Given the following SQL query and context: Query: SELECT destination, COUNT(*) FROM Flight GROUP BY destination Context: CREATE TABLE Flight (destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all destinations and the number of flights to each destination. The answer to your question is: SELECT destination, COUNT(*) FROM Flight GROUP BY destination. [/s> |
SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE Flight (origin VARCHAR) | Which origin has most number of flights? | <s>[INST] Given the following SQL query and context: Query: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Flight (origin VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which origin has most number of flights? The answer to your question is: SELECT origin FROM Flight GROUP BY origin ORDER BY COUNT(*) DESC LIMIT 1. [/s> |
SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE Flight (destination VARCHAR) | Which destination has least number of flights? | <s>[INST] Given the following SQL query and context: Query: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE Flight (destination VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which destination has least number of flights? The answer to your question is: SELECT destination FROM Flight GROUP BY destination ORDER BY COUNT(*) LIMIT 1. [/s> |
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99 | CREATE TABLE Flight (aid VARCHAR, flno VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) | What is the aircraft name for the flight with number 99 | <s>[INST] Given the following SQL query and context: Query: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99 Context: CREATE TABLE Flight (aid VARCHAR, flno VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the aircraft name for the flight with number 99 The answer to your question is: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99. [/s> |
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300" | CREATE TABLE Flight (flno VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) | Show all flight numbers with aircraft Airbus A340-300. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300" Context: CREATE TABLE Flight (flno VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all flight numbers with aircraft Airbus A340-300. The answer to your question is: SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300". [/s> |
SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid | CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) | Show aircraft names and number of flights for each aircraft. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show aircraft names and number of flights for each aircraft. The answer to your question is: SELECT T2.name, COUNT(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid. [/s> |
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2 | CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) | Show names for all aircraft with at least two flights. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2 Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Flight (aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show names for all aircraft with at least two flights. The answer to your question is: SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING COUNT(*) >= 2. [/s> |
SELECT COUNT(DISTINCT eid) FROM Certificate | CREATE TABLE Certificate (eid VARCHAR) | How many employees have certificate. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT eid) FROM Certificate Context: CREATE TABLE Certificate (eid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many employees have certificate. The answer to your question is: SELECT COUNT(DISTINCT eid) FROM Certificate. [/s> |
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate | CREATE TABLE Employee (eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR) | Show ids for all employees who don't have a certificate. | <s>[INST] Given the following SQL query and context: Query: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate Context: CREATE TABLE Employee (eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show ids for all employees who don't have a certificate. The answer to your question is: SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate. [/s> |
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" | CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Employee (eid VARCHAR, name VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) | Show names for all aircrafts of which John Williams has certificates. | <s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR); CREATE TABLE Employee (eid VARCHAR, name VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show names for all aircrafts of which John Williams has certificates. The answer to your question is: 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". [/s> |
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" | CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) | Show names for all employees who have certificate of Boeing 737-800. | <s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show names for all employees who have certificate of Boeing 737-800. The answer to your question is: 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". [/s> |
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" | CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) | Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300. | <s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300. The answer to your question is: 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". [/s> |
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" | CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Employee (name VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) | Show names for all employees who do not have certificate of Boeing 737-800. | <s>[INST] Given the following SQL query and context: Query: 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" Context: CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Employee (name VARCHAR); CREATE TABLE Aircraft (aid VARCHAR, name VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show names for all employees who do not have certificate of Boeing 737-800. The answer to your question is: 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". [/s> |
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 | CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) | Show the name of aircraft which fewest people have its certificate. | <s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show the name of aircraft which fewest people have its certificate. The answer to your question is: 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. [/s> |
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 | CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR, distance INTEGER) | Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate. | <s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Certificate (aid VARCHAR); CREATE TABLE Aircraft (name VARCHAR, aid VARCHAR, distance INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate. The answer to your question is: 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. [/s> |
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 | CREATE TABLE Certificate (eid VARCHAR); CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) | what is the salary and name of the employee who has the most number of aircraft certificates? | <s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Certificate (eid VARCHAR); CREATE TABLE Employee (name VARCHAR, salary VARCHAR, eid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: what is the salary and name of the employee who has the most number of aircraft certificates? The answer to your question is: 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. [/s> |
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 | CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) | What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000? | <s>[INST] Given the following SQL query and context: Query: 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 Context: CREATE TABLE Aircraft (aid VARCHAR, distance INTEGER); CREATE TABLE Employee (name VARCHAR, eid VARCHAR); CREATE TABLE Certificate (eid VARCHAR, aid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000? The answer to your question is: 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. [/s> |
SELECT COUNT(DISTINCT allergy) FROM Allergy_type | CREATE TABLE Allergy_type (allergy VARCHAR) | How many allergies are there? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT allergy) FROM Allergy_type Context: CREATE TABLE Allergy_type (allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many allergies are there? The answer to your question is: SELECT COUNT(DISTINCT allergy) FROM Allergy_type. [/s> |
SELECT COUNT(DISTINCT allergytype) FROM Allergy_type | CREATE TABLE Allergy_type (allergytype VARCHAR) | How many different allergy types exist? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many different allergy types exist? The answer to your question is: SELECT COUNT(DISTINCT allergytype) FROM Allergy_type. [/s> |
SELECT DISTINCT allergytype FROM Allergy_type | CREATE TABLE Allergy_type (allergytype VARCHAR) | Show all allergy types. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT allergytype FROM Allergy_type Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergy types. The answer to your question is: SELECT DISTINCT allergytype FROM Allergy_type. [/s> |
SELECT allergy, allergytype FROM Allergy_type | CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) | Show all allergies and their types. | <s>[INST] Given the following SQL query and context: Query: SELECT allergy, allergytype FROM Allergy_type Context: CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergies and their types. The answer to your question is: SELECT allergy, allergytype FROM Allergy_type. [/s> |
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food" | CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) | Show all allergies with type food. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food" Context: CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergies with type food. The answer to your question is: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food". [/s> |
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat" | CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) | What is the type of allergy Cat? | <s>[INST] Given the following SQL query and context: Query: SELECT allergytype FROM Allergy_type WHERE allergy = "Cat" Context: CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What is the type of allergy Cat? The answer to your question is: SELECT allergytype FROM Allergy_type WHERE allergy = "Cat". [/s> |
SELECT COUNT(*) FROM Allergy_type WHERE allergytype = "animal" | CREATE TABLE Allergy_type (allergytype VARCHAR) | How many allergies have type animal? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = "animal" Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many allergies have type animal? The answer to your question is: SELECT COUNT(*) FROM Allergy_type WHERE allergytype = "animal". [/s> |
SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype | CREATE TABLE Allergy_type (allergytype VARCHAR) | Show all allergy types and the number of allergies in each type. | <s>[INST] Given the following SQL query and context: Query: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergy types and the number of allergies in each type. The answer to your question is: SELECT allergytype, COUNT(*) FROM Allergy_type GROUP BY allergytype. [/s> |
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE Allergy_type (allergytype VARCHAR) | Which allergy type has most number of allergies? | <s>[INST] Given the following SQL query and context: Query: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which allergy type has most number of allergies? The answer to your question is: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) DESC LIMIT 1. [/s> |
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) LIMIT 1 | CREATE TABLE Allergy_type (allergytype VARCHAR) | Which allergy type has least number of allergies? | <s>[INST] Given the following SQL query and context: Query: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) LIMIT 1 Context: CREATE TABLE Allergy_type (allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which allergy type has least number of allergies? The answer to your question is: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY COUNT(*) LIMIT 1. [/s> |
SELECT COUNT(*) FROM Student | CREATE TABLE Student (Id VARCHAR) | How many students are there? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Student Context: CREATE TABLE Student (Id VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students are there? The answer to your question is: SELECT COUNT(*) FROM Student. [/s> |
SELECT Fname, Lname FROM Student | CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR) | Show first name and last name for all students. | <s>[INST] Given the following SQL query and context: Query: SELECT Fname, Lname FROM Student Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show first name and last name for all students. The answer to your question is: SELECT Fname, Lname FROM Student. [/s> |
SELECT COUNT(DISTINCT advisor) FROM Student | CREATE TABLE Student (advisor VARCHAR) | How many different advisors are listed? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(DISTINCT advisor) FROM Student Context: CREATE TABLE Student (advisor VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many different advisors are listed? The answer to your question is: SELECT COUNT(DISTINCT advisor) FROM Student. [/s> |
SELECT DISTINCT Major FROM Student | CREATE TABLE Student (Major VARCHAR) | Show all majors. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT Major FROM Student Context: CREATE TABLE Student (Major VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all majors. The answer to your question is: SELECT DISTINCT Major FROM Student. [/s> |
SELECT DISTINCT city_code FROM Student | CREATE TABLE Student (city_code VARCHAR) | Show all cities where students live. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT city_code FROM Student Context: CREATE TABLE Student (city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all cities where students live. The answer to your question is: SELECT DISTINCT city_code FROM Student. [/s> |
SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F' | CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Sex VARCHAR) | Show first name, last name, age for all female students. Their sex is F. | <s>[INST] Given the following SQL query and context: Query: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F' Context: CREATE TABLE Student (Fname VARCHAR, Lname VARCHAR, Age VARCHAR, Sex VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show first name, last name, age for all female students. Their sex is F. The answer to your question is: SELECT Fname, Lname, Age FROM Student WHERE Sex = 'F'. [/s> |
SELECT StuID FROM Student WHERE Sex = 'M' | CREATE TABLE Student (StuID VARCHAR, Sex VARCHAR) | Show student ids for all male students. | <s>[INST] Given the following SQL query and context: Query: SELECT StuID FROM Student WHERE Sex = 'M' Context: CREATE TABLE Student (StuID VARCHAR, Sex VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show student ids for all male students. The answer to your question is: SELECT StuID FROM Student WHERE Sex = 'M'. [/s> |
SELECT COUNT(*) FROM Student WHERE age = 18 | CREATE TABLE Student (age VARCHAR) | How many students are age 18? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Student WHERE age = 18 Context: CREATE TABLE Student (age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students are age 18? The answer to your question is: SELECT COUNT(*) FROM Student WHERE age = 18. [/s> |
SELECT StuID FROM Student WHERE age > 20 | CREATE TABLE Student (StuID VARCHAR, age INTEGER) | Show all student ids who are older than 20. | <s>[INST] Given the following SQL query and context: Query: SELECT StuID FROM Student WHERE age > 20 Context: CREATE TABLE Student (StuID VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show all student ids who are older than 20. The answer to your question is: SELECT StuID FROM Student WHERE age > 20. [/s> |
SELECT city_code FROM Student WHERE LName = "Kim" | CREATE TABLE Student (city_code VARCHAR, LName VARCHAR) | Which city does the student whose last name is "Kim" live in? | <s>[INST] Given the following SQL query and context: Query: SELECT city_code FROM Student WHERE LName = "Kim" Context: CREATE TABLE Student (city_code VARCHAR, LName VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which city does the student whose last name is "Kim" live in? The answer to your question is: SELECT city_code FROM Student WHERE LName = "Kim". [/s> |
SELECT Advisor FROM Student WHERE StuID = 1004 | CREATE TABLE Student (Advisor VARCHAR, StuID VARCHAR) | Who is the advisor of student with ID 1004? | <s>[INST] Given the following SQL query and context: Query: SELECT Advisor FROM Student WHERE StuID = 1004 Context: CREATE TABLE Student (Advisor VARCHAR, StuID VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Who is the advisor of student with ID 1004? The answer to your question is: SELECT Advisor FROM Student WHERE StuID = 1004. [/s> |
SELECT COUNT(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI" | CREATE TABLE Student (city_code VARCHAR) | How many students live in HKG or CHI? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI" Context: CREATE TABLE Student (city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students live in HKG or CHI? The answer to your question is: SELECT COUNT(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI". [/s> |
SELECT MIN(age), AVG(age), MAX(age) FROM Student | CREATE TABLE Student (age INTEGER) | Show the minimum, average, and maximum age of all students. | <s>[INST] Given the following SQL query and context: Query: SELECT MIN(age), AVG(age), MAX(age) FROM Student Context: CREATE TABLE Student (age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the minimum, average, and maximum age of all students. The answer to your question is: SELECT MIN(age), AVG(age), MAX(age) FROM Student. [/s> |
SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student) | CREATE TABLE Student (LName VARCHAR, age INTEGER) | What is the last name of the youngest student? | <s>[INST] Given the following SQL query and context: Query: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student) Context: CREATE TABLE Student (LName VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: What is the last name of the youngest student? The answer to your question is: SELECT LName FROM Student WHERE age = (SELECT MIN(age) FROM Student). [/s> |
SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student) | CREATE TABLE Student (StuID VARCHAR, age INTEGER) | Show the student id of the oldest student. | <s>[INST] Given the following SQL query and context: Query: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student) Context: CREATE TABLE Student (StuID VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the student id of the oldest student. The answer to your question is: SELECT StuID FROM Student WHERE age = (SELECT MAX(age) FROM Student). [/s> |
SELECT major, COUNT(*) FROM Student GROUP BY major | CREATE TABLE Student (major VARCHAR) | Show all majors and corresponding number of students. | <s>[INST] Given the following SQL query and context: Query: SELECT major, COUNT(*) FROM Student GROUP BY major Context: CREATE TABLE Student (major VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all majors and corresponding number of students. The answer to your question is: SELECT major, COUNT(*) FROM Student GROUP BY major. [/s> |
SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE Student (major VARCHAR) | Which major has most number of students? | <s>[INST] Given the following SQL query and context: Query: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Student (major VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which major has most number of students? The answer to your question is: SELECT major FROM Student GROUP BY major ORDER BY COUNT(*) DESC LIMIT 1. [/s> |
SELECT age, COUNT(*) FROM Student GROUP BY age | CREATE TABLE Student (age VARCHAR) | Show all ages and corresponding number of students. | <s>[INST] Given the following SQL query and context: Query: SELECT age, COUNT(*) FROM Student GROUP BY age Context: CREATE TABLE Student (age VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all ages and corresponding number of students. The answer to your question is: SELECT age, COUNT(*) FROM Student GROUP BY age. [/s> |
SELECT AVG(age), sex FROM Student GROUP BY sex | CREATE TABLE Student (sex VARCHAR, age INTEGER) | Show the average age for male and female students. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(age), sex FROM Student GROUP BY sex Context: CREATE TABLE Student (sex VARCHAR, age INTEGER) [/INST] Based on the provided SQL query and context, your question is: Show the average age for male and female students. The answer to your question is: SELECT AVG(age), sex FROM Student GROUP BY sex. [/s> |
SELECT city_code, COUNT(*) FROM Student GROUP BY city_code | CREATE TABLE Student (city_code VARCHAR) | Show all cities and corresponding number of students. | <s>[INST] Given the following SQL query and context: Query: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code Context: CREATE TABLE Student (city_code VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all cities and corresponding number of students. The answer to your question is: SELECT city_code, COUNT(*) FROM Student GROUP BY city_code. [/s> |
SELECT advisor, COUNT(*) FROM Student GROUP BY advisor | CREATE TABLE Student (advisor VARCHAR) | Show all advisors and corresponding number of students. | <s>[INST] Given the following SQL query and context: Query: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor Context: CREATE TABLE Student (advisor VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all advisors and corresponding number of students. The answer to your question is: SELECT advisor, COUNT(*) FROM Student GROUP BY advisor. [/s> |
SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE Student (advisor VARCHAR) | Which advisor has most number of students? | <s>[INST] Given the following SQL query and context: Query: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Student (advisor VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which advisor has most number of students? The answer to your question is: SELECT advisor FROM Student GROUP BY advisor ORDER BY COUNT(*) DESC LIMIT 1. [/s> |
SELECT COUNT(*) FROM Has_allergy WHERE Allergy = "Cat" | CREATE TABLE Has_allergy (Allergy VARCHAR) | How many students have cat allergies? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = "Cat" Context: CREATE TABLE Has_allergy (Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students have cat allergies? The answer to your question is: SELECT COUNT(*) FROM Has_allergy WHERE Allergy = "Cat". [/s> |
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2 | CREATE TABLE Has_allergy (StuID VARCHAR) | Show all student IDs who have at least two allergies. | <s>[INST] Given the following SQL query and context: Query: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2 Context: CREATE TABLE Has_allergy (StuID VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all student IDs who have at least two allergies. The answer to your question is: SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT(*) >= 2. [/s> |
SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy | CREATE TABLE Has_allergy (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR) | What are the student ids of students who don't have any allergies? | <s>[INST] Given the following SQL query and context: Query: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy Context: CREATE TABLE Has_allergy (StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the student ids of students who don't have any allergies? The answer to your question is: SELECT StuID FROM Student EXCEPT SELECT StuID FROM Has_allergy. [/s> |
SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND T1.allergy = "Milk" OR T1.allergy = "Eggs" | CREATE TABLE Student (StuID VARCHAR, sex VARCHAR); CREATE TABLE has_allergy (StuID VARCHAR, allergy VARCHAR) | How many female students have milk or egg allergies? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND T1.allergy = "Milk" OR T1.allergy = "Eggs" Context: CREATE TABLE Student (StuID VARCHAR, sex VARCHAR); CREATE TABLE has_allergy (StuID VARCHAR, allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many female students have milk or egg allergies? The answer to your question is: SELECT COUNT(*) FROM has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID WHERE T2.sex = "F" AND T1.allergy = "Milk" OR T1.allergy = "Eggs". [/s> |
SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food" | CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) | How many students have a food allergy? | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food" Context: CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergy VARCHAR, allergytype VARCHAR) [/INST] Based on the provided SQL query and context, your question is: How many students have a food allergy? The answer to your question is: SELECT COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food". [/s> |
SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1 | CREATE TABLE Has_allergy (Allergy VARCHAR) | Which allergy has most number of students affected? | <s>[INST] Given the following SQL query and context: Query: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1 Context: CREATE TABLE Has_allergy (Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Which allergy has most number of students affected? The answer to your question is: SELECT Allergy FROM Has_allergy GROUP BY Allergy ORDER BY COUNT(*) DESC LIMIT 1. [/s> |
SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy | CREATE TABLE Has_allergy (Allergy VARCHAR) | Show all allergies with number of students affected. | <s>[INST] Given the following SQL query and context: Query: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy Context: CREATE TABLE Has_allergy (Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergies with number of students affected. The answer to your question is: SELECT Allergy, COUNT(*) FROM Has_allergy GROUP BY Allergy. [/s> |
SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype | CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) | Show all allergy type with number of students affected. | <s>[INST] Given the following SQL query and context: Query: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype Context: CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Show all allergy type with number of students affected. The answer to your question is: SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype. [/s> |
SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") | CREATE TABLE Has_allergy (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR) | Find the last name and age of the student who has allergy to both milk and cat. | <s>[INST] Given the following SQL query and context: Query: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") Context: CREATE TABLE Has_allergy (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (lname VARCHAR, age VARCHAR, StuID VARCHAR, Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the last name and age of the student who has allergy to both milk and cat. The answer to your question is: SELECT lname, age FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" INTERSECT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat"). [/s> |
SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy | CREATE TABLE Has_allergy (Allergy VARCHAR, StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR); CREATE TABLE Allergy_type (Allergy VARCHAR, AllergyType VARCHAR) | What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies. | <s>[INST] Given the following SQL query and context: Query: SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy Context: CREATE TABLE Has_allergy (Allergy VARCHAR, StuID VARCHAR); CREATE TABLE Student (StuID VARCHAR, Fname VARCHAR); CREATE TABLE Allergy_type (Allergy VARCHAR, AllergyType VARCHAR) [/INST] Based on the provided SQL query and context, your question is: What are the allergies and their types that the student with first name Lisa has? And order the result by name of allergies. The answer to your question is: SELECT T1.Allergy, T1.AllergyType FROM Allergy_type AS T1 JOIN Has_allergy AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T3.StuID = T2.StuID WHERE T3.Fname = "Lisa" ORDER BY T1.Allergy. [/s> |
SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") | CREATE TABLE Student (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Has_allergy (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR) | Find the first name and gender of the student who has allergy to milk but not cat. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat") Context: CREATE TABLE Student (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Has_allergy (fname VARCHAR, sex VARCHAR, StuID VARCHAR, Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the first name and gender of the student who has allergy to milk but not cat. The answer to your question is: SELECT fname, sex FROM Student WHERE StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Milk" EXCEPT SELECT StuID FROM Has_allergy WHERE Allergy = "Cat"). [/s> |
SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal") | CREATE TABLE Student (age INTEGER, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) | Find the average age of the students who have allergies with food and animal types. | <s>[INST] Given the following SQL query and context: Query: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal") Context: CREATE TABLE Student (age INTEGER, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the average age of the students who have allergies with food and animal types. The answer to your question is: SELECT AVG(age) FROM Student WHERE StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" INTERSECT SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "animal"). [/s> |
SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") | CREATE TABLE Student (fname VARCHAR, lname VARCHAR, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) | List the first and last name of the students who do not have any food type allergy. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") Context: CREATE TABLE Student (fname VARCHAR, lname VARCHAR, StuID VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (StuID VARCHAR, Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: List the first and last name of the students who do not have any food type allergy. The answer to your question is: SELECT fname, lname FROM Student WHERE NOT StuID IN (SELECT T1.StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food"). [/s> |
SELECT COUNT(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") | CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Student (sex VARCHAR, StuID VARCHAR) | Find the number of male (sex is 'M') students who have some food type allery. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food") Context: CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Student (sex VARCHAR, StuID VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of male (sex is 'M') students who have some food type allery. The answer to your question is: SELECT COUNT(*) FROM Student WHERE sex = "M" AND StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food"). [/s> |
SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat" | CREATE TABLE Has_Allergy (stuid VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, city_code VARCHAR, stuid VARCHAR) | Find the different first names and cities of the students who have allergy to milk or cat. | <s>[INST] Given the following SQL query and context: Query: SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat" Context: CREATE TABLE Has_Allergy (stuid VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, city_code VARCHAR, stuid VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the different first names and cities of the students who have allergy to milk or cat. The answer to your question is: SELECT DISTINCT T1.fname, T1.city_code FROM Student AS T1 JOIN Has_Allergy AS T2 ON T1.stuid = T2.stuid WHERE T2.Allergy = "Milk" OR T2.Allergy = "Cat". [/s> |
SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal") | CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Student (age VARCHAR, StuID VARCHAR) | Find the number of students who are older than 18 and do not have allergy to either food or animal. | <s>[INST] Given the following SQL query and context: Query: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal") Context: CREATE TABLE Allergy_Type (Allergy VARCHAR, allergytype VARCHAR); CREATE TABLE Has_allergy (Allergy VARCHAR); CREATE TABLE Student (age VARCHAR, StuID VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the number of students who are older than 18 and do not have allergy to either food or animal. The answer to your question is: SELECT COUNT(*) FROM Student WHERE age > 18 AND NOT StuID IN (SELECT StuID FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy WHERE T2.allergytype = "food" OR T2.allergytype = "animal"). [/s> |
SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy") | CREATE TABLE Has_allergy (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR) | Find the first name and major of the students who are not allegry to soy. | <s>[INST] Given the following SQL query and context: Query: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy") Context: CREATE TABLE Has_allergy (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR); CREATE TABLE Student (fname VARCHAR, major VARCHAR, StuID VARCHAR, Allergy VARCHAR) [/INST] Based on the provided SQL query and context, your question is: Find the first name and major of the students who are not allegry to soy. The answer to your question is: SELECT fname, major FROM Student WHERE NOT StuID IN (SELECT StuID FROM Has_allergy WHERE Allergy = "Soy"). [/s> |