SQL
stringlengths
18
577
question
stringlengths
317
11.5k
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the numbers of the shortest flights?
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the average distance and average price for flights from Los Angeles.
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the average distance and price for all flights from LA?
SELECT origin , count(*) FROM Flight GROUP BY origin
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show all origins and the number of flights from each origin.
SELECT origin , count(*) FROM Flight GROUP BY origin
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. For each origin, how many flights came from there?
SELECT destination , count(*) FROM Flight GROUP BY destination
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show all destinations and the number of flights to each destination.
SELECT destination , count(*) FROM Flight GROUP BY destination
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the destinations and number of flights to each one?
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Which origin has most number of flights?
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What place has the most flights coming from there?
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Which destination has least number of flights?
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What destination has the fewest number of flights?
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the aircraft name for the flight with number 99
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the name of the aircraft that was on flight number 99?
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show all flight numbers with aircraft Airbus A340-300.
SELECT T1.flno FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T2.name = "Airbus A340-300"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the flight numbers for the aircraft Airbus A340-300?
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show aircraft names and number of flights for each aircraft.
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the name of each aircraft and how many flights does each one complete?
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show names for all aircraft with at least two flights.
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names for all aircrafts with at least 2 flights?
SELECT count(DISTINCT eid) FROM Certificate
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. How many employees have certificate.
SELECT count(DISTINCT eid) FROM Certificate
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the count of distinct employees with certificates?
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show ids for all employees who don't have a certificate.
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the ids of all employees that don't have certificates?
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show names for all aircrafts of which John Williams has certificates.
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names of all aircrafts that John Williams have certificates to be able to fly?
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show names for all employees who have certificate of Boeing 737-800.
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names of all employees who have a certificate to fly Boeing 737-800?
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show names for all employees who have certificates on both Boeing 737-800 and Airbus A340-300.
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names of all employees who can fly both the Boeing 737-800 and the Airbus A340-300?
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show names for all employees who do not have certificate of Boeing 737-800.
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"
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names of all employees who are not certified to fly Boeing 737-800s?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show the name of aircraft which fewest people have its certificate.
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What are the names of the aircraft that the least people are certified to fly?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. Show the name and distance of the aircrafts with more than 5000 distance and which at least 5 people have its certificate.
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. 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?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. what is the salary and name of the employee who has the most number of aircraft certificates?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the salaray and name of the employee that is certified to fly the most planes?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the salary and name of the employee who has the most number of certificates on aircrafts with distance more than 5000?
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
Given the Table flight having columns as flno has datatype number, origin has datatype text, destination has datatype text, distance has datatype number, departure_date has datatype time, arrival_date has datatype time, price has datatype number, aid has datatype number which has flno and Given the Table aircraft having columns as aid has datatype number, name has datatype text, distance has datatype number which has aid and Given the Table employee having columns as eid has datatype number, name has datatype text, salary has datatype number which has eid and Given the Table certificate having columns as eid has datatype number, aid has datatype number which has eid. Answer the question by writing the appropriate SQL code. What is the salaray and name of the employee with the most certificates to fly planes more than 5000?
SELECT count(DISTINCT allergy) FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many allergies are there?
SELECT count(DISTINCT allergy) FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many allergy entries are there?
SELECT count(DISTINCT allergytype) FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many different allergy types exist?
SELECT count(DISTINCT allergytype) FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many distinct allergies are there?
SELECT DISTINCT allergytype FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all allergy types.
SELECT DISTINCT allergytype FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the different allergy types?
SELECT allergy , allergytype FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all allergies and their types.
SELECT allergy , allergytype FROM Allergy_type
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the allergies and their types?
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all allergies with type food.
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are all the different food allergies?
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the type of allergy Cat?
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is allergy type of a cat allergy?
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many allergies have type animal?
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many animal type allergies exist?
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all allergy types and the number of allergies in each type.
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the allergy types and how many allergies correspond to each one?
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which allergy type has most number of allergies?
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which allergy type is most common?
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which allergy type has least number of allergies?
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which allergy type is the least common?
SELECT count(*) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are there?
SELECT count(*) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the total number of students?
SELECT Fname , Lname FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show first name and last name for all students.
SELECT Fname , Lname FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the full names of all students
SELECT count(DISTINCT advisor) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many different advisors are listed?
SELECT count(DISTINCT advisor) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many advisors are there?
SELECT DISTINCT Major FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all majors.
SELECT DISTINCT Major FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the different majors?
SELECT DISTINCT city_code FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all cities where students live.
SELECT DISTINCT city_code FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What cities do students live in?
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show first name, last name, age for all female students. Their sex is F.
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the full names and ages for all female students whose sex is F?
SELECT StuID FROM Student WHERE Sex = 'M'
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show student ids for all male students.
SELECT StuID FROM Student WHERE Sex = 'M'
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the student ids for all male students?
SELECT count(*) FROM Student WHERE age = 18
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are age 18?
SELECT count(*) FROM Student WHERE age = 18
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are 18 years old?
SELECT StuID FROM Student WHERE age > 20
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all student ids who are older than 20.
SELECT StuID FROM Student WHERE age > 20
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the student ids for students over 20 years old?
SELECT city_code FROM Student WHERE LName = "Kim"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which city does the student whose last name is "Kim" live in?
SELECT city_code FROM Student WHERE LName = "Kim"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Give the city that the student whose family name is Kim lives in.
SELECT Advisor FROM Student WHERE StuID = 1004
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Who is the advisor of student with ID 1004?
SELECT Advisor FROM Student WHERE StuID = 1004
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Who advises student 1004?
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students live in HKG or CHI?
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Give the number of students living in either HKG or CHI.
SELECT min(age) , avg(age) , max(age) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show the minimum, average, and maximum age of all students.
SELECT min(age) , avg(age) , max(age) FROM Student
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the minimum, mean, and maximum age across all students?
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the last name of the youngest student?
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Provide the last name of the youngest student.
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show the student id of the oldest student.
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What student id corresponds to the oldest student?
SELECT major , count(*) FROM Student GROUP BY major
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all majors and corresponding number of students.
SELECT major , count(*) FROM Student GROUP BY major
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students are there for each major?
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Which major has most number of students?
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the largest major?
SELECT age , count(*) FROM Student GROUP BY age
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all ages and corresponding number of students.
SELECT age , count(*) FROM Student GROUP BY age
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How old is each student and how many students are each age?
SELECT avg(age) , sex FROM Student GROUP BY sex
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show the average age for male and female students.
SELECT avg(age) , sex FROM Student GROUP BY sex
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the average ages for male and female students?
SELECT city_code , count(*) FROM Student GROUP BY city_code
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all cities and corresponding number of students.
SELECT city_code , count(*) FROM Student GROUP BY city_code
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many students live in each city?
SELECT advisor , count(*) FROM Student GROUP BY advisor
Given the Table allergy type having columns as Allergy has datatype text, AllergyType has datatype text which has Allergy and Given the Table has allergy having columns as StuID has datatype number, Allergy has datatype text which has StuID and Given the Table student having columns as StuID has datatype number, LName has datatype text, Fname has datatype text, Age has datatype number, Sex has datatype text, Major has datatype number, Advisor has datatype number, city_code has datatype text which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Show all advisors and corresponding number of students.