query_id
int64 0
7k
| database_id
stringclasses 140
values | table_id
listlengths 1
5
| query
stringlengths 16
224
| answer
stringlengths 18
577
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
400 |
flight_1
|
[
"flight"
] |
What are the numbers of the shortest flights?
|
SELECT flno FROM Flight ORDER BY distance ASC LIMIT 3
|
medium
|
401 |
flight_1
|
[
"flight"
] |
What is the average distance and average price for flights from Los Angeles.
|
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
|
medium
|
402 |
flight_1
|
[
"flight"
] |
What is the average distance and price for all flights from LA?
|
SELECT avg(distance) , avg(price) FROM Flight WHERE origin = "Los Angeles"
|
medium
|
403 |
flight_1
|
[
"flight"
] |
Show all origins and the number of flights from each origin.
|
SELECT origin , count(*) FROM Flight GROUP BY origin
|
medium
|
404 |
flight_1
|
[
"flight"
] |
For each origin, how many flights came from there?
|
SELECT origin , count(*) FROM Flight GROUP BY origin
|
medium
|
405 |
flight_1
|
[
"flight"
] |
Show all destinations and the number of flights to each destination.
|
SELECT destination , count(*) FROM Flight GROUP BY destination
|
medium
|
406 |
flight_1
|
[
"flight"
] |
What are the destinations and number of flights to each one?
|
SELECT destination , count(*) FROM Flight GROUP BY destination
|
medium
|
407 |
flight_1
|
[
"flight"
] |
Which origin has most number of flights?
|
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
|
hard
|
408 |
flight_1
|
[
"flight"
] |
What place has the most flights coming from there?
|
SELECT origin FROM Flight GROUP BY origin ORDER BY count(*) DESC LIMIT 1
|
hard
|
409 |
flight_1
|
[
"flight"
] |
Which destination has least number of flights?
|
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
|
hard
|
410 |
flight_1
|
[
"flight"
] |
What destination has the fewest number of flights?
|
SELECT destination FROM Flight GROUP BY destination ORDER BY count(*) LIMIT 1
|
hard
|
411 |
flight_1
|
[
"flight",
"aircraft"
] |
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
|
medium
|
412 |
flight_1
|
[
"flight",
"aircraft"
] |
What is the name of the aircraft that was on flight number 99?
|
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid WHERE T1.flno = 99
|
medium
|
413 |
flight_1
|
[
"flight",
"aircraft"
] |
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"
|
medium
|
414 |
flight_1
|
[
"flight",
"aircraft"
] |
What are the flight numbers for the 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"
|
medium
|
415 |
flight_1
|
[
"flight",
"aircraft"
] |
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
|
medium
|
416 |
flight_1
|
[
"flight",
"aircraft"
] |
What is the name of each aircraft and how many flights does each one complete?
|
SELECT T2.name , count(*) FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid
|
medium
|
417 |
flight_1
|
[
"flight",
"aircraft"
] |
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
|
medium
|
418 |
flight_1
|
[
"flight",
"aircraft"
] |
What are the names for all aircrafts with at least 2 flights?
|
SELECT T2.name FROM Flight AS T1 JOIN Aircraft AS T2 ON T1.aid = T2.aid GROUP BY T1.aid HAVING count(*) >= 2
|
medium
|
419 |
flight_1
|
[
"certificate"
] |
How many employees have certificate.
|
SELECT count(DISTINCT eid) FROM Certificate
|
easy
|
420 |
flight_1
|
[
"certificate"
] |
What is the count of distinct employees with certificates?
|
SELECT count(DISTINCT eid) FROM Certificate
|
easy
|
421 |
flight_1
|
[
"employee",
"certificate"
] |
Show ids for all employees who don't have a certificate.
|
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
|
hard
|
422 |
flight_1
|
[
"employee",
"certificate"
] |
What are the ids of all employees that don't have certificates?
|
SELECT eid FROM Employee EXCEPT SELECT eid FROM Certificate
|
hard
|
423 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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"
|
hard
|
424 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
What are the names of all aircrafts that John Williams have certificates to be able to fly?
|
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"
|
hard
|
425 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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"
|
hard
|
426 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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"
|
hard
|
427 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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"
|
extra
|
428 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
What are the names of all employees who can fly both the Boeing 737-800 and the 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"
|
extra
|
429 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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"
|
hard
|
430 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
What are the names of all employees who are not certified to fly Boeing 737-800s?
|
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"
|
hard
|
431 |
flight_1
|
[
"certificate",
"aircraft"
] |
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
|
extra
|
432 |
flight_1
|
[
"certificate",
"aircraft"
] |
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 GROUP BY T1.aid ORDER BY count(*) DESC LIMIT 1
|
extra
|
433 |
flight_1
|
[
"certificate",
"aircraft"
] |
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
|
extra
|
434 |
flight_1
|
[
"certificate",
"aircraft"
] |
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 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
|
extra
|
435 |
flight_1
|
[
"employee",
"certificate"
] |
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
|
extra
|
436 |
flight_1
|
[
"employee",
"certificate"
] |
What is the salaray and name of the employee that is certified to fly the most planes?
|
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
|
extra
|
437 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
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
|
extra
|
438 |
flight_1
|
[
"employee",
"certificate",
"aircraft"
] |
What is the salaray and name of the employee with the most certificates to fly planes 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
|
extra
|
439 |
allergy_1
|
[
"allergy_type"
] |
How many allergies are there?
|
SELECT count(DISTINCT allergy) FROM Allergy_type
|
easy
|
440 |
allergy_1
|
[
"allergy_type"
] |
How many allergy entries are there?
|
SELECT count(DISTINCT allergy) FROM Allergy_type
|
easy
|
441 |
allergy_1
|
[
"allergy_type"
] |
How many different allergy types exist?
|
SELECT count(DISTINCT allergytype) FROM Allergy_type
|
easy
|
442 |
allergy_1
|
[
"allergy_type"
] |
How many distinct allergies are there?
|
SELECT count(DISTINCT allergytype) FROM Allergy_type
|
easy
|
443 |
allergy_1
|
[
"allergy_type"
] |
Show all allergy types.
|
SELECT DISTINCT allergytype FROM Allergy_type
|
easy
|
444 |
allergy_1
|
[
"allergy_type"
] |
What are the different allergy types?
|
SELECT DISTINCT allergytype FROM Allergy_type
|
easy
|
445 |
allergy_1
|
[
"allergy_type"
] |
Show all allergies and their types.
|
SELECT allergy , allergytype FROM Allergy_type
|
medium
|
446 |
allergy_1
|
[
"allergy_type"
] |
What are the allergies and their types?
|
SELECT allergy , allergytype FROM Allergy_type
|
medium
|
447 |
allergy_1
|
[
"allergy_type"
] |
Show all allergies with type food.
|
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
|
easy
|
448 |
allergy_1
|
[
"allergy_type"
] |
What are all the different food allergies?
|
SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype = "food"
|
easy
|
449 |
allergy_1
|
[
"allergy_type"
] |
What is the type of allergy Cat?
|
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
|
easy
|
450 |
allergy_1
|
[
"allergy_type"
] |
What is allergy type of a cat allergy?
|
SELECT allergytype FROM Allergy_type WHERE allergy = "Cat"
|
easy
|
451 |
allergy_1
|
[
"allergy_type"
] |
How many allergies have type animal?
|
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
|
easy
|
452 |
allergy_1
|
[
"allergy_type"
] |
How many animal type allergies exist?
|
SELECT count(*) FROM Allergy_type WHERE allergytype = "animal"
|
easy
|
453 |
allergy_1
|
[
"allergy_type"
] |
Show all allergy types and the number of allergies in each type.
|
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
|
medium
|
454 |
allergy_1
|
[
"allergy_type"
] |
What are the allergy types and how many allergies correspond to each one?
|
SELECT allergytype , count(*) FROM Allergy_type GROUP BY allergytype
|
medium
|
455 |
allergy_1
|
[
"allergy_type"
] |
Which allergy type has most number of allergies?
|
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
|
hard
|
456 |
allergy_1
|
[
"allergy_type"
] |
Which allergy type is most common?
|
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1
|
hard
|
457 |
allergy_1
|
[
"allergy_type"
] |
Which allergy type has least number of allergies?
|
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
|
hard
|
458 |
allergy_1
|
[
"allergy_type"
] |
Which allergy type is the least common?
|
SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1
|
hard
|
459 |
allergy_1
|
[
"student"
] |
How many students are there?
|
SELECT count(*) FROM Student
|
easy
|
460 |
allergy_1
|
[
"student"
] |
What is the total number of students?
|
SELECT count(*) FROM Student
|
easy
|
461 |
allergy_1
|
[
"student"
] |
Show first name and last name for all students.
|
SELECT Fname , Lname FROM Student
|
medium
|
462 |
allergy_1
|
[
"student"
] |
What are the full names of all students
|
SELECT Fname , Lname FROM Student
|
medium
|
463 |
allergy_1
|
[
"student"
] |
How many different advisors are listed?
|
SELECT count(DISTINCT advisor) FROM Student
|
easy
|
464 |
allergy_1
|
[
"student"
] |
How many advisors are there?
|
SELECT count(DISTINCT advisor) FROM Student
|
easy
|
465 |
allergy_1
|
[
"student"
] |
Show all majors.
|
SELECT DISTINCT Major FROM Student
|
easy
|
466 |
allergy_1
|
[
"student"
] |
What are the different majors?
|
SELECT DISTINCT Major FROM Student
|
easy
|
467 |
allergy_1
|
[
"student"
] |
Show all cities where students live.
|
SELECT DISTINCT city_code FROM Student
|
easy
|
468 |
allergy_1
|
[
"student"
] |
What cities do students live in?
|
SELECT DISTINCT city_code FROM Student
|
easy
|
469 |
allergy_1
|
[
"student"
] |
Show first name, last name, age for all female students. Their sex is F.
|
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
|
medium
|
470 |
allergy_1
|
[
"student"
] |
What are the full names and ages for all female students whose sex is F?
|
SELECT Fname , Lname , Age FROM Student WHERE Sex = 'F'
|
medium
|
471 |
allergy_1
|
[
"student"
] |
Show student ids for all male students.
|
SELECT StuID FROM Student WHERE Sex = 'M'
|
easy
|
472 |
allergy_1
|
[
"student"
] |
What are the student ids for all male students?
|
SELECT StuID FROM Student WHERE Sex = 'M'
|
easy
|
473 |
allergy_1
|
[
"student"
] |
How many students are age 18?
|
SELECT count(*) FROM Student WHERE age = 18
|
easy
|
474 |
allergy_1
|
[
"student"
] |
How many students are 18 years old?
|
SELECT count(*) FROM Student WHERE age = 18
|
easy
|
475 |
allergy_1
|
[
"student"
] |
Show all student ids who are older than 20.
|
SELECT StuID FROM Student WHERE age > 20
|
easy
|
476 |
allergy_1
|
[
"student"
] |
What are the student ids for students over 20 years old?
|
SELECT StuID FROM Student WHERE age > 20
|
easy
|
477 |
allergy_1
|
[
"student"
] |
Which city does the student whose last name is "Kim" live in?
|
SELECT city_code FROM Student WHERE LName = "Kim"
|
easy
|
478 |
allergy_1
|
[
"student"
] |
Give the city that the student whose family name is Kim lives in.
|
SELECT city_code FROM Student WHERE LName = "Kim"
|
easy
|
479 |
allergy_1
|
[
"student"
] |
Who is the advisor of student with ID 1004?
|
SELECT Advisor FROM Student WHERE StuID = 1004
|
easy
|
480 |
allergy_1
|
[
"student"
] |
Who advises student 1004?
|
SELECT Advisor FROM Student WHERE StuID = 1004
|
easy
|
481 |
allergy_1
|
[
"student"
] |
How many students live in HKG or CHI?
|
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
|
medium
|
482 |
allergy_1
|
[
"student"
] |
Give the number of students living in either HKG or CHI.
|
SELECT count(*) FROM Student WHERE city_code = "HKG" OR city_code = "CHI"
|
medium
|
483 |
allergy_1
|
[
"student"
] |
Show the minimum, average, and maximum age of all students.
|
SELECT min(age) , avg(age) , max(age) FROM Student
|
medium
|
484 |
allergy_1
|
[
"student"
] |
What is the minimum, mean, and maximum age across all students?
|
SELECT min(age) , avg(age) , max(age) FROM Student
|
medium
|
485 |
allergy_1
|
[
"student"
] |
What is the last name of the youngest student?
|
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
|
hard
|
486 |
allergy_1
|
[
"student"
] |
Provide the last name of the youngest student.
|
SELECT LName FROM Student WHERE age = (SELECT min(age) FROM Student)
|
hard
|
487 |
allergy_1
|
[
"student"
] |
Show the student id of the oldest student.
|
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
|
hard
|
488 |
allergy_1
|
[
"student"
] |
What student id corresponds to the oldest student?
|
SELECT StuID FROM Student WHERE age = (SELECT max(age) FROM Student)
|
hard
|
489 |
allergy_1
|
[
"student"
] |
Show all majors and corresponding number of students.
|
SELECT major , count(*) FROM Student GROUP BY major
|
medium
|
490 |
allergy_1
|
[
"student"
] |
How many students are there for each major?
|
SELECT major , count(*) FROM Student GROUP BY major
|
medium
|
491 |
allergy_1
|
[
"student"
] |
Which major has most number of students?
|
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
|
hard
|
492 |
allergy_1
|
[
"student"
] |
What is the largest major?
|
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
|
hard
|
493 |
allergy_1
|
[
"student"
] |
Show all ages and corresponding number of students.
|
SELECT age , count(*) FROM Student GROUP BY age
|
medium
|
494 |
allergy_1
|
[
"student"
] |
How old is each student and how many students are each age?
|
SELECT age , count(*) FROM Student GROUP BY age
|
medium
|
495 |
allergy_1
|
[
"student"
] |
Show the average age for male and female students.
|
SELECT avg(age) , sex FROM Student GROUP BY sex
|
medium
|
496 |
allergy_1
|
[
"student"
] |
What are the average ages for male and female students?
|
SELECT avg(age) , sex FROM Student GROUP BY sex
|
medium
|
497 |
allergy_1
|
[
"student"
] |
Show all cities and corresponding number of students.
|
SELECT city_code , count(*) FROM Student GROUP BY city_code
|
medium
|
498 |
allergy_1
|
[
"student"
] |
How many students live in each city?
|
SELECT city_code , count(*) FROM Student GROUP BY city_code
|
medium
|
499 |
allergy_1
|
[
"student"
] |
Show all advisors and corresponding number of students.
|
SELECT advisor , count(*) FROM Student GROUP BY advisor
|
medium
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.