query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
1,600 |
car_racing
|
[
"team"
] |
Find the manager and sponsor for each team and order them by the car owner.
|
SELECT Manager , Sponsor FROM team ORDER BY Car_Owner
|
medium
|
1,601 |
car_racing
|
[
"team"
] |
Find the make that has more than one team.
|
SELECT make FROM team GROUP BY team HAVING count(*) > 1
|
easy
|
1,602 |
car_racing
|
[
"team"
] |
Which make has more than one team?
|
SELECT make FROM team GROUP BY team HAVING count(*) > 1
|
easy
|
1,603 |
car_racing
|
[
"team"
] |
What are the makes of the teams with car owner "Buddy Arrington"?
|
SELECT Make FROM team WHERE Car_Owner = "Buddy Arrington"
|
easy
|
1,604 |
car_racing
|
[
"team"
] |
Find the make of the team whose car owner is "Buddy Arrington".
|
SELECT Make FROM team WHERE Car_Owner = "Buddy Arrington"
|
easy
|
1,605 |
car_racing
|
[
"driver"
] |
What are the maximum and minimum points of drivers.
|
SELECT max(Points) , min(Points) FROM driver
|
medium
|
1,606 |
car_racing
|
[
"driver"
] |
Find the highest and lowest points of drivers.
|
SELECT max(Points) , min(Points) FROM driver
|
medium
|
1,607 |
car_racing
|
[
"driver"
] |
How many drivers have points smaller than 150?
|
SELECT count(*) FROM driver WHERE Points < 150
|
easy
|
1,608 |
car_racing
|
[
"driver"
] |
Count the number of drivers whose points are below 150.
|
SELECT count(*) FROM driver WHERE Points < 150
|
easy
|
1,609 |
car_racing
|
[
"driver"
] |
List all the driver names in ascending order of age.
|
SELECT Driver FROM driver ORDER BY Age ASC
|
easy
|
1,610 |
car_racing
|
[
"driver"
] |
Sort the driver names by age in ascending order.
|
SELECT Driver FROM driver ORDER BY Age ASC
|
easy
|
1,611 |
car_racing
|
[
"driver"
] |
List all the driver names in descending order of points.
|
SELECT Driver FROM driver ORDER BY Points DESC
|
easy
|
1,612 |
car_racing
|
[
"driver"
] |
What is the list of drivers ordered by points in descending order?
|
SELECT Driver FROM driver ORDER BY Points DESC
|
easy
|
1,613 |
car_racing
|
[
"country",
"driver"
] |
Please show the names of drivers, and countries they are from.
|
SELECT T2.Driver , T1.Country FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country
|
medium
|
1,614 |
car_racing
|
[
"country",
"driver"
] |
For each driver, return his or her name and country.
|
SELECT T2.Driver , T1.Country FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country
|
medium
|
1,615 |
car_racing
|
[
"country",
"driver"
] |
Show the maximum points of the drivers from countries with capital "Dublin"
|
SELECT max(T2.Points) FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T1.Capital = "Dublin"
|
medium
|
1,616 |
car_racing
|
[
"country",
"driver"
] |
What is the maximum points of the drivers from a country whose capital is "Dublin"?
|
SELECT max(T2.Points) FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T1.Capital = "Dublin"
|
medium
|
1,617 |
car_racing
|
[
"country",
"driver"
] |
What is the average age of drivers from countries with official native language "English"
|
SELECT avg(T2.age) FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T1.Official_native_language = "English"
|
medium
|
1,618 |
car_racing
|
[
"country",
"driver"
] |
Find the average age of the drivers from the countries that use "English" as official native language.
|
SELECT avg(T2.age) FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T1.Official_native_language = "English"
|
medium
|
1,619 |
car_racing
|
[
"country",
"driver"
] |
What are the countries that have drivers with points larger than 150?
|
SELECT T1.Country FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T2.Points > 150
|
medium
|
1,620 |
car_racing
|
[
"country",
"driver"
] |
Find all the countries where some drivers have points above 150.
|
SELECT T1.Country FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country WHERE T2.Points > 150
|
medium
|
1,621 |
car_racing
|
[
"country",
"driver"
] |
What is the capital of the country where the driver with the most points is from?
|
SELECT T1.Capital FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country ORDER BY T2.Points DESC LIMIT 1
|
hard
|
1,622 |
car_racing
|
[
"country",
"driver"
] |
Which country is the driver with the highest points from? Give me the capital of the country.
|
SELECT T1.Capital FROM country AS T1 JOIN driver AS T2 ON T1.Country_ID = T2.Country ORDER BY T2.Points DESC LIMIT 1
|
hard
|
1,623 |
car_racing
|
[
"driver"
] |
List each make with the number of drivers with that make.
|
SELECT Make , COUNT(*) FROM driver GROUP BY Make
|
medium
|
1,624 |
car_racing
|
[
"driver"
] |
For each make, return the make and the count of drivers with that make.
|
SELECT Make , COUNT(*) FROM driver GROUP BY Make
|
medium
|
1,625 |
car_racing
|
[
"driver"
] |
List the make that are associated with most drivers.
|
SELECT Make FROM driver GROUP BY Make ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
1,626 |
car_racing
|
[
"driver"
] |
Which make does the most drivers have?
|
SELECT Make FROM driver GROUP BY Make ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
1,627 |
car_racing
|
[
"driver"
] |
List the driver makes that are associated with at least three drivers.
|
SELECT Make FROM driver GROUP BY Make HAVING COUNT(*) >= 3
|
easy
|
1,628 |
car_racing
|
[
"driver"
] |
Which make is associated with 3 or more drivers?
|
SELECT Make FROM driver GROUP BY Make HAVING COUNT(*) >= 3
|
easy
|
1,629 |
car_racing
|
[
"team",
"team_driver"
] |
List the names of teams that do not have any drivers.
|
SELECT Team FROM team WHERE Team_ID NOT IN (SELECT Team_ID FROM team_driver)
|
hard
|
1,630 |
car_racing
|
[
"team",
"team_driver"
] |
Which team does not have drivers?
|
SELECT Team FROM team WHERE Team_ID NOT IN (SELECT Team_ID FROM team_driver)
|
hard
|
1,631 |
car_racing
|
[
"country",
"driver"
] |
Which country has both drivers with make "Dodge" and drivers with make "Chevrolet"?
|
SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Dodge" INTERSECT SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Chevrolet"
|
extra
|
1,632 |
car_racing
|
[
"country",
"driver"
] |
Find the countries in which there are both drivers with make "Dodge" and drivers with make "Chevrolet".
|
SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Dodge" INTERSECT SELECT t2.country FROM driver AS t1 JOIN country AS t2 ON t1.country = t2.country_id WHERE t1.Make = "Chevrolet"
|
extra
|
1,633 |
car_racing
|
[
"driver"
] |
Show total and average points of all drivers.
|
SELECT sum(Points) , avg(Points) FROM driver
|
medium
|
1,634 |
car_racing
|
[
"driver"
] |
What are the total and average points of drivers?
|
SELECT sum(Points) , avg(Points) FROM driver
|
medium
|
1,635 |
car_racing
|
[
"country",
"driver"
] |
Find the countries where no driver come from.
|
SELECT country FROM country WHERE country_id NOT IN (SELECT country FROM driver)
|
hard
|
1,636 |
car_racing
|
[
"country",
"driver"
] |
Which countries do not have any drivers?
|
SELECT country FROM country WHERE country_id NOT IN (SELECT country FROM driver)
|
hard
|
1,637 |
car_racing
|
[
"team",
"team_driver"
] |
What are the manager and sponsor of the team that has the most drivers?
|
SELECT t1.manager , t1.sponsor FROM team AS t1 JOIN team_driver AS t2 ON t1.team_id = t2.team_id GROUP BY t2.team_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
1,638 |
car_racing
|
[
"team",
"team_driver"
] |
Find the manager and sponsor of the team that has the most drivers.
|
SELECT t1.manager , t1.sponsor FROM team AS t1 JOIN team_driver AS t2 ON t1.team_id = t2.team_id GROUP BY t2.team_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
1,639 |
car_racing
|
[
"team",
"team_driver"
] |
What are the manager and car owner of the team that has at least 2 drivers?
|
SELECT t1.manager , t1.car_owner FROM team AS t1 JOIN team_driver AS t2 ON t1.team_id = t2.team_id GROUP BY t2.team_id HAVING count(*) >= 2
|
medium
|
1,640 |
car_racing
|
[
"team",
"team_driver"
] |
Find the team with two or more drivers and return the the manager and car owner of the team.
|
SELECT t1.manager , t1.car_owner FROM team AS t1 JOIN team_driver AS t2 ON t1.team_id = t2.team_id GROUP BY t2.team_id HAVING count(*) >= 2
|
medium
|
1,641 |
institution_sports
|
[
"institution"
] |
How many institutions are there?
|
SELECT count(*) FROM institution
|
easy
|
1,642 |
institution_sports
|
[
"institution"
] |
Count the number of institutions.
|
SELECT count(*) FROM institution
|
easy
|
1,643 |
institution_sports
|
[
"institution"
] |
List the names of institutions in ascending alphabetical order.
|
SELECT Name FROM institution ORDER BY Name ASC
|
easy
|
1,644 |
institution_sports
|
[
"institution"
] |
What are the names of institutions, ordered alphabetically?
|
SELECT Name FROM institution ORDER BY Name ASC
|
easy
|
1,645 |
institution_sports
|
[
"institution"
] |
List the names of institutions in ascending order of founded year.
|
SELECT Name FROM institution ORDER BY Founded ASC
|
easy
|
1,646 |
institution_sports
|
[
"institution"
] |
What are the names of institutions, ordered by the years in which they were founded?
|
SELECT Name FROM institution ORDER BY Founded ASC
|
easy
|
1,647 |
institution_sports
|
[
"institution"
] |
What are the cities and provinces of institutions?
|
SELECT City , Province FROM institution
|
medium
|
1,648 |
institution_sports
|
[
"institution"
] |
Return the cities and provinces of institutions.
|
SELECT City , Province FROM institution
|
medium
|
1,649 |
institution_sports
|
[
"institution"
] |
What are the maximum and minimum enrollment of all institutions?
|
SELECT max(Enrollment) , min(Enrollment) FROM institution
|
medium
|
1,650 |
institution_sports
|
[
"institution"
] |
Return the maximum and minimum enrollment across all institutions.
|
SELECT max(Enrollment) , min(Enrollment) FROM institution
|
medium
|
1,651 |
institution_sports
|
[
"institution"
] |
What are the affiliations of institutions that are not in city "Vancouver"?
|
SELECT Affiliation FROM institution WHERE City != "Vancouver"
|
easy
|
1,652 |
institution_sports
|
[
"institution"
] |
Return the affiliations of instituions that are not in the city of Vancouver.
|
SELECT Affiliation FROM institution WHERE City != "Vancouver"
|
easy
|
1,653 |
institution_sports
|
[
"institution"
] |
What are the stadiums of institutions in descending order of the capacity.
|
SELECT Stadium FROM institution ORDER BY Capacity DESC
|
easy
|
1,654 |
institution_sports
|
[
"institution"
] |
Return the stadiums of institutions, ordered by capacity descending.
|
SELECT Stadium FROM institution ORDER BY Capacity DESC
|
easy
|
1,655 |
institution_sports
|
[
"institution"
] |
What is the stadium of the institution with the largest enrollment?
|
SELECT Stadium FROM institution ORDER BY Enrollment DESC LIMIT 1
|
medium
|
1,656 |
institution_sports
|
[
"institution"
] |
Give the stadium of the institution which is the greatest enrollment.
|
SELECT Stadium FROM institution ORDER BY Enrollment DESC LIMIT 1
|
medium
|
1,657 |
institution_sports
|
[
"championship",
"institution"
] |
What are the names and nicknames of institutions?
|
SELECT T2.Name , T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID
|
medium
|
1,658 |
institution_sports
|
[
"championship",
"institution"
] |
Return the names of institutions, as well as their nicknames.
|
SELECT T2.Name , T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID
|
medium
|
1,659 |
institution_sports
|
[
"championship",
"institution"
] |
What is the nickname of the institution with the smallest enrollment?
|
SELECT T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T2.Enrollment ASC LIMIT 1
|
hard
|
1,660 |
institution_sports
|
[
"championship",
"institution"
] |
Return the nickname of the institution with the lowest enrollment.
|
SELECT T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T2.Enrollment ASC LIMIT 1
|
hard
|
1,661 |
institution_sports
|
[
"championship",
"institution"
] |
List the names of institutions in descending order of the number of championships.
|
SELECT T2.Name FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T1.Number_of_Championships DESC
|
medium
|
1,662 |
institution_sports
|
[
"championship",
"institution"
] |
What are the names of institutions, ordered descending by their number of championships?
|
SELECT T2.Name FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T1.Number_of_Championships DESC
|
medium
|
1,663 |
institution_sports
|
[
"championship",
"institution"
] |
List the names of institutions with at least one championship.
|
SELECT T2.Name FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID WHERE T1.Number_of_Championships >= 1
|
medium
|
1,664 |
institution_sports
|
[
"championship",
"institution"
] |
What are the names of institutions that have 1 or more championships?
|
SELECT T2.Name FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID WHERE T1.Number_of_Championships >= 1
|
medium
|
1,665 |
institution_sports
|
[
"championship",
"institution"
] |
What is the total number of championship of institution with public affiliation?
|
SELECT sum(T1.Number_of_Championships) FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID WHERE T2.Affiliation = "Public"
|
medium
|
1,666 |
institution_sports
|
[
"championship",
"institution"
] |
Return the total number of championships of institutions that have a Public affiliation.
|
SELECT sum(T1.Number_of_Championships) FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID WHERE T2.Affiliation = "Public"
|
medium
|
1,667 |
institution_sports
|
[
"institution"
] |
What are different types of affiliations of institutions and the corresponding number of institutions?
|
SELECT Affiliation , COUNT(*) FROM institution GROUP BY Affiliation
|
medium
|
1,668 |
institution_sports
|
[
"institution"
] |
How many institutions are there for each type of affiliation?
|
SELECT Affiliation , COUNT(*) FROM institution GROUP BY Affiliation
|
medium
|
1,669 |
institution_sports
|
[
"institution"
] |
What is the most common type of affiliation for institutions?
|
SELECT Affiliation FROM institution GROUP BY Affiliation ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
1,670 |
institution_sports
|
[
"institution"
] |
Return the most common type of affiliation across all institutions.
|
SELECT Affiliation FROM institution GROUP BY Affiliation ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
1,671 |
institution_sports
|
[
"institution"
] |
In which years were more than one institution founded?
|
SELECT Founded , COUNT(*) FROM institution GROUP BY Founded HAVING COUNT(*) > 1
|
medium
|
1,672 |
institution_sports
|
[
"institution"
] |
Return the years in which more than 1 institution was founded, as well as the number of institutions founded in each of those.
|
SELECT Founded , COUNT(*) FROM institution GROUP BY Founded HAVING COUNT(*) > 1
|
medium
|
1,673 |
institution_sports
|
[
"championship",
"institution"
] |
List the nicknames of institutions in descending order of capacity.
|
SELECT T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T2.Capacity DESC
|
medium
|
1,674 |
institution_sports
|
[
"championship",
"institution"
] |
What are the nicknames of institutions, ordered descending by their capacities?
|
SELECT T1.Nickname FROM championship AS T1 JOIN institution AS T2 ON T1.Institution_ID = T2.Institution_ID ORDER BY T2.Capacity DESC
|
medium
|
1,675 |
institution_sports
|
[
"institution"
] |
What are the total enrollment of institutions in city `` Vancouver '' or `` Calgary '' ?
|
select sum(enrollment) from institution where city = "vancouver" or city = "calgary"
|
medium
|
1,676 |
institution_sports
|
[
"institution"
] |
Return all the enrollments of institutions in either the city of Vancouver or the city of Calgary .
|
select sum(enrollment) from institution where city = "vancouver" or city = "calgary"
|
medium
|
1,677 |
institution_sports
|
[
"institution"
] |
Show the provinces that have both institutions founded before 1920 and institutions founded after 1950.
|
SELECT Province FROM institution WHERE Founded < 1920 INTERSECT SELECT Province FROM institution WHERE Founded > 1950
|
hard
|
1,678 |
institution_sports
|
[
"institution"
] |
What are the provinces that have not only institutions founded before 1920, but also institutions founded after 1950?
|
SELECT Province FROM institution WHERE Founded < 1920 INTERSECT SELECT Province FROM institution WHERE Founded > 1950
|
hard
|
1,679 |
institution_sports
|
[
"institution"
] |
How many distinct provinces are the institutions in?
|
SELECT count(DISTINCT Province) FROM institution
|
easy
|
1,680 |
institution_sports
|
[
"institution"
] |
Count the number of different provinces that have institutions.
|
SELECT count(DISTINCT Province) FROM institution
|
easy
|
1,681 |
warehouse_1
|
[
"warehouses"
] |
Select all details of all warehouses.
|
SELECT * FROM warehouses
|
easy
|
1,682 |
warehouse_1
|
[
"warehouses"
] |
What is all the information about the warehouses?
|
SELECT * FROM warehouses
|
easy
|
1,683 |
warehouse_1
|
[
"boxes",
"warehouses"
] |
Find all different contents stored in New York.
|
SELECT DISTINCT T1.contents FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse = T2.code WHERE LOCATION = 'New York'
|
medium
|
1,684 |
warehouse_1
|
[
"boxes",
"warehouses"
] |
What are all the different contents stored in boxes in New York?
|
SELECT DISTINCT T1.contents FROM boxes AS T1 JOIN warehouses AS T2 ON T1.warehouse = T2.code WHERE LOCATION = 'New York'
|
medium
|
1,685 |
warehouse_1
|
[
"boxes"
] |
Select contents of all boxes with a value larger than $150.
|
SELECT CONTENTS FROM boxes WHERE Value > 150
|
easy
|
1,686 |
warehouse_1
|
[
"boxes"
] |
What are the contents of boxes with value greater than 150?
|
SELECT CONTENTS FROM boxes WHERE Value > 150
|
easy
|
1,687 |
warehouse_1
|
[
"boxes"
] |
Select the warehouse code and the average value of the boxes in each warehouse.
|
SELECT warehouse , avg(value) FROM boxes GROUP BY warehouse
|
medium
|
1,688 |
warehouse_1
|
[
"boxes"
] |
What is the average value of boxes for each warehouse?
|
SELECT warehouse , avg(value) FROM boxes GROUP BY warehouse
|
medium
|
1,689 |
warehouse_1
|
[
"boxes"
] |
Find the average and total values of all boxes.
|
SELECT avg(value) , sum(value) FROM boxes
|
medium
|
1,690 |
warehouse_1
|
[
"boxes"
] |
What are the average and total values across all boxes?
|
SELECT avg(value) , sum(value) FROM boxes
|
medium
|
1,691 |
warehouse_1
|
[
"warehouses"
] |
Find the average and total capacity of all warehouses.
|
SELECT avg(capacity) , sum(capacity) FROM warehouses
|
medium
|
1,692 |
warehouse_1
|
[
"warehouses"
] |
What are the average and total capacities across all warehouses?
|
SELECT avg(capacity) , sum(capacity) FROM warehouses
|
medium
|
1,693 |
warehouse_1
|
[
"boxes"
] |
Find the average and maximum value for each different content.
|
SELECT avg(value) , max(value) , CONTENTS FROM boxes GROUP BY CONTENTS
|
medium
|
1,694 |
warehouse_1
|
[
"boxes"
] |
What are the average and maximum values for each type of content in boxes?
|
SELECT avg(value) , max(value) , CONTENTS FROM boxes GROUP BY CONTENTS
|
medium
|
1,695 |
warehouse_1
|
[
"boxes"
] |
Find the content that has the highest total values in all boxes.
|
SELECT CONTENTS FROM boxes ORDER BY value DESC LIMIT 1
|
medium
|
1,696 |
warehouse_1
|
[
"boxes"
] |
What is the content with the greatest value across all boxes?
|
SELECT CONTENTS FROM boxes ORDER BY value DESC LIMIT 1
|
medium
|
1,697 |
warehouse_1
|
[
"boxes"
] |
Select the average value of all the boxes.
|
SELECT avg(value) FROM boxes
|
easy
|
1,698 |
warehouse_1
|
[
"boxes"
] |
What is the average value of boxes?
|
SELECT avg(value) FROM boxes
|
easy
|
1,699 |
warehouse_1
|
[
"boxes"
] |
Select all distinct contents in all the boxes.
|
SELECT DISTINCT CONTENTS FROM boxes
|
easy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.