query_id
int64 0
1.03k
| database_id
stringclasses 20
values | table_id
listlengths 1
4
| query
stringlengths 18
174
| answer
stringlengths 20
422
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
800 |
world_1
|
[
"country"
] |
What are the names and areas of countries with the top 5 largest area?
|
SELECT Name , SurfaceArea FROM country ORDER BY SurfaceArea DESC LIMIT 5
|
medium
|
801 |
world_1
|
[
"country"
] |
Return the names and surface areas of the 5 largest countries.
|
SELECT Name , SurfaceArea FROM country ORDER BY SurfaceArea DESC LIMIT 5
|
medium
|
802 |
world_1
|
[
"country"
] |
What are names of countries with the top 3 largest population?
|
SELECT Name FROM country ORDER BY Population DESC LIMIT 3
|
medium
|
803 |
world_1
|
[
"country"
] |
Return the names of the 3 most populated countries.
|
SELECT Name FROM country ORDER BY Population DESC LIMIT 3
|
medium
|
804 |
world_1
|
[
"country"
] |
What are the names of the nations with the 3 lowest populations?
|
SELECT Name FROM country ORDER BY Population ASC LIMIT 3
|
medium
|
805 |
world_1
|
[
"country"
] |
Return the names of the 3 countries with the fewest people.
|
SELECT Name FROM country ORDER BY Population ASC LIMIT 3
|
medium
|
806 |
world_1
|
[
"country"
] |
how many countries are in Asia?
|
SELECT count(*) FROM country WHERE continent = "Asia"
|
easy
|
807 |
world_1
|
[
"country"
] |
Count the number of countries in Asia.
|
SELECT count(*) FROM country WHERE continent = "Asia"
|
easy
|
808 |
world_1
|
[
"country"
] |
What are the names of the countries that are in the continent of Europe and have a population of 80000?
|
SELECT Name FROM country WHERE continent = "Europe" AND Population = "80000"
|
medium
|
809 |
world_1
|
[
"country"
] |
Give the names of countries that are in Europe and have a population equal to 80000.
|
SELECT Name FROM country WHERE continent = "Europe" AND Population = "80000"
|
medium
|
810 |
world_1
|
[
"country"
] |
What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ?
|
select sum(population) , avg(surfacearea) from country where continent = "north america" and surfacearea > 3000
|
hard
|
811 |
world_1
|
[
"country"
] |
Give the total population and average surface area corresponding to countries in North America that have a surface area greater than 3000 .
|
select sum(population) , avg(surfacearea) from country where continent = "north america" and surfacearea > 3000
|
hard
|
812 |
world_1
|
[
"city"
] |
What are the cities whose population is between 160000 and 900000?
|
SELECT name FROM city WHERE Population BETWEEN 160000 AND 900000
|
easy
|
813 |
world_1
|
[
"city"
] |
Return the names of cities that have a population between 160000 and 900000 .
|
select name from city where population between 160000 and 900000
|
easy
|
814 |
world_1
|
[
"countrylanguage"
] |
Which language is spoken by the largest number of countries?
|
SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY count(*) DESC LIMIT 1
|
hard
|
815 |
world_1
|
[
"countrylanguage"
] |
Give the language that is spoken in the most countries.
|
SELECT LANGUAGE FROM countrylanguage GROUP BY LANGUAGE ORDER BY count(*) DESC LIMIT 1
|
hard
|
816 |
world_1
|
[
"countrylanguage"
] |
What is the language spoken by the largest percentage of people in each country?
|
SELECT LANGUAGE , CountryCode , max(Percentage) FROM countrylanguage GROUP BY CountryCode
|
medium
|
817 |
world_1
|
[
"countrylanguage"
] |
What are the country codes of the different countries, and what are the languages spoken by the greatest percentage of people for each?
|
SELECT LANGUAGE , CountryCode , max(Percentage) FROM countrylanguage GROUP BY CountryCode
|
medium
|
818 |
world_1
|
[
"countrylanguage"
] |
What is the total number of countries where Spanish is spoken by the largest percentage of people?
|
SELECT count(*) , max(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
extra
|
819 |
world_1
|
[
"countrylanguage"
] |
Count the number of countries for which Spanish is the predominantly spoken language.
|
SELECT count(*) , max(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
extra
|
820 |
world_1
|
[
"countrylanguage"
] |
What are the codes of countries where Spanish is spoken by the largest percentage of people?
|
SELECT CountryCode , max(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
medium
|
821 |
world_1
|
[
"countrylanguage"
] |
Return the codes of countries for which Spanish is the predominantly spoken language.
|
SELECT CountryCode , max(Percentage) FROM countrylanguage WHERE LANGUAGE = "Spanish" GROUP BY CountryCode
|
medium
|
822 |
orchestra
|
[
"conductor"
] |
How many conductors are there?
|
SELECT count(*) FROM conductor
|
easy
|
823 |
orchestra
|
[
"conductor"
] |
Count the number of conductors.
|
SELECT count(*) FROM conductor
|
easy
|
824 |
orchestra
|
[
"conductor"
] |
List the names of conductors in ascending order of age.
|
SELECT Name FROM conductor ORDER BY Age ASC
|
easy
|
825 |
orchestra
|
[
"conductor"
] |
What are the names of conductors, ordered by age?
|
SELECT Name FROM conductor ORDER BY Age ASC
|
easy
|
826 |
orchestra
|
[
"conductor"
] |
What are the names of conductors whose nationalities are not "USA"?
|
SELECT Name FROM conductor WHERE Nationality != 'USA'
|
easy
|
827 |
orchestra
|
[
"conductor"
] |
Return the names of conductors that do not have the nationality "USA".
|
SELECT Name FROM conductor WHERE Nationality != 'USA'
|
easy
|
828 |
orchestra
|
[
"orchestra"
] |
What are the record companies of orchestras in descending order of years in which they were founded?
|
SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC
|
easy
|
829 |
orchestra
|
[
"orchestra"
] |
Return the record companies of orchestras, sorted descending by the years in which they were founded.
|
SELECT Record_Company FROM orchestra ORDER BY Year_of_Founded DESC
|
easy
|
830 |
orchestra
|
[
"SHOW"
] |
What is the average attendance of shows?
|
SELECT avg(Attendance) FROM SHOW
|
easy
|
831 |
orchestra
|
[
"SHOW"
] |
Return the average attendance across all shows.
|
SELECT avg(Attendance) FROM SHOW
|
easy
|
832 |
orchestra
|
[
"performance"
] |
What are the maximum and minimum share of performances whose type is not "Live final".
|
SELECT max(SHARE) , min(SHARE) FROM performance WHERE TYPE != "Live final"
|
medium
|
833 |
orchestra
|
[
"performance"
] |
Return the maximum and minimum shares for performances that do not have the type "Live final".
|
SELECT max(SHARE) , min(SHARE) FROM performance WHERE TYPE != "Live final"
|
medium
|
834 |
orchestra
|
[
"conductor"
] |
How many different nationalities do conductors have?
|
SELECT count(DISTINCT Nationality) FROM conductor
|
easy
|
835 |
orchestra
|
[
"conductor"
] |
Count the number of different nationalities of conductors.
|
SELECT count(DISTINCT Nationality) FROM conductor
|
easy
|
836 |
orchestra
|
[
"conductor"
] |
List names of conductors in descending order of years of work.
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC
|
easy
|
837 |
orchestra
|
[
"conductor"
] |
What are the names of conductors, sorted descending by the number of years they have worked?
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC
|
easy
|
838 |
orchestra
|
[
"conductor"
] |
List the name of the conductor with the most years of work.
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
|
medium
|
839 |
orchestra
|
[
"conductor"
] |
What is the name of the conductor who has worked the greatest number of years?
|
SELECT Name FROM conductor ORDER BY Year_of_Work DESC LIMIT 1
|
medium
|
840 |
orchestra
|
[
"conductor",
"orchestra"
] |
Show the names of conductors and the orchestras they have conducted.
|
SELECT T1.Name , T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID
|
medium
|
841 |
orchestra
|
[
"conductor",
"orchestra"
] |
What are the names of conductors as well as the corresonding orchestras that they have conducted?
|
SELECT T1.Name , T2.Orchestra FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID
|
medium
|
842 |
orchestra
|
[
"conductor",
"orchestra"
] |
Show the names of conductors that have conducted more than one orchestras.
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID HAVING COUNT(*) > 1
|
medium
|
843 |
orchestra
|
[
"conductor",
"orchestra"
] |
What are the names of conductors who have conducted at more than one orchestra?
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID HAVING COUNT(*) > 1
|
medium
|
844 |
orchestra
|
[
"conductor",
"orchestra"
] |
Show the name of the conductor that has conducted the most number of orchestras.
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID ORDER BY COUNT(*) DESC LIMIT 1
|
extra
|
845 |
orchestra
|
[
"conductor",
"orchestra"
] |
What is the name of the conductor who has conducted the most orchestras?
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID GROUP BY T2.Conductor_ID ORDER BY COUNT(*) DESC LIMIT 1
|
extra
|
846 |
orchestra
|
[
"conductor",
"orchestra"
] |
Please show the name of the conductor that has conducted orchestras founded after 2008.
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID WHERE Year_of_Founded > 2008
|
medium
|
847 |
orchestra
|
[
"conductor",
"orchestra"
] |
What are the names of conductors who have conducted orchestras founded after the year 2008?
|
SELECT T1.Name FROM conductor AS T1 JOIN orchestra AS T2 ON T1.Conductor_ID = T2.Conductor_ID WHERE Year_of_Founded > 2008
|
medium
|
848 |
orchestra
|
[
"orchestra"
] |
Please show the different record companies and the corresponding number of orchestras.
|
SELECT Record_Company , COUNT(*) FROM orchestra GROUP BY Record_Company
|
medium
|
849 |
orchestra
|
[
"orchestra"
] |
How many orchestras does each record company manage?
|
SELECT Record_Company , COUNT(*) FROM orchestra GROUP BY Record_Company
|
medium
|
850 |
orchestra
|
[
"orchestra"
] |
Please show the record formats of orchestras in ascending order of count.
|
SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC
|
medium
|
851 |
orchestra
|
[
"orchestra"
] |
What are the major record formats of orchestras, sorted by their frequency?
|
SELECT Major_Record_Format FROM orchestra GROUP BY Major_Record_Format ORDER BY COUNT(*) ASC
|
medium
|
852 |
orchestra
|
[
"orchestra"
] |
List the record company shared by the most number of orchestras.
|
SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
853 |
orchestra
|
[
"orchestra"
] |
What is the record company used by the greatest number of orchestras?
|
SELECT Record_Company FROM orchestra GROUP BY Record_Company ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
854 |
orchestra
|
[
"orchestra",
"performance"
] |
List the names of orchestras that have no performance.
|
SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance)
|
hard
|
855 |
orchestra
|
[
"orchestra",
"performance"
] |
What are the orchestras that do not have any performances?
|
SELECT Orchestra FROM orchestra WHERE Orchestra_ID NOT IN (SELECT Orchestra_ID FROM performance)
|
hard
|
856 |
orchestra
|
[
"orchestra"
] |
Show the record companies shared by orchestras founded before 2003 and after 2003.
|
SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003
|
hard
|
857 |
orchestra
|
[
"orchestra"
] |
What are the record companies that are used by both orchestras founded before 2003 and those founded after 2003?
|
SELECT Record_Company FROM orchestra WHERE Year_of_Founded < 2003 INTERSECT SELECT Record_Company FROM orchestra WHERE Year_of_Founded > 2003
|
hard
|
858 |
orchestra
|
[
"orchestra"
] |
Find the number of orchestras whose record format is "CD" or "DVD".
|
SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format = "CD" OR Major_Record_Format = "DVD"
|
medium
|
859 |
orchestra
|
[
"orchestra"
] |
Count the number of orchestras that have CD or DVD as their record format.
|
SELECT COUNT(*) FROM orchestra WHERE Major_Record_Format = "CD" OR Major_Record_Format = "DVD"
|
medium
|
860 |
orchestra
|
[
"orchestra",
"performance"
] |
Show the years in which orchestras that have given more than one performance are founded.
|
SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1
|
medium
|
861 |
orchestra
|
[
"orchestra",
"performance"
] |
What are years of founding for orchestras that have had more than a single performance?
|
SELECT Year_of_Founded FROM orchestra AS T1 JOIN performance AS T2 ON T1.Orchestra_ID = T2.Orchestra_ID GROUP BY T2.Orchestra_ID HAVING COUNT(*) > 1
|
medium
|
862 |
network_1
|
[
"Highschooler"
] |
How many high schoolers are there?
|
SELECT count(*) FROM Highschooler
|
easy
|
863 |
network_1
|
[
"Highschooler"
] |
Count the number of high schoolers.
|
SELECT count(*) FROM Highschooler
|
easy
|
864 |
network_1
|
[
"Highschooler"
] |
Show the names and grades of each high schooler.
|
SELECT name , grade FROM Highschooler
|
medium
|
865 |
network_1
|
[
"Highschooler"
] |
What are the names and grades for each high schooler?
|
SELECT name , grade FROM Highschooler
|
medium
|
866 |
network_1
|
[
"Highschooler"
] |
Show all the grades of the high schoolers.
|
SELECT grade FROM Highschooler
|
easy
|
867 |
network_1
|
[
"Highschooler"
] |
What is the grade of each high schooler?
|
SELECT grade FROM Highschooler
|
easy
|
868 |
network_1
|
[
"Highschooler"
] |
What grade is Kyle in?
|
SELECT grade FROM Highschooler WHERE name = "Kyle"
|
easy
|
869 |
network_1
|
[
"Highschooler"
] |
Return the grade for the high schooler named Kyle.
|
SELECT grade FROM Highschooler WHERE name = "Kyle"
|
easy
|
870 |
network_1
|
[
"Highschooler"
] |
Show the names of all high schoolers in grade 10.
|
SELECT name FROM Highschooler WHERE grade = 10
|
easy
|
871 |
network_1
|
[
"Highschooler"
] |
What are the names of all high schoolers in grade 10?
|
SELECT name FROM Highschooler WHERE grade = 10
|
easy
|
872 |
network_1
|
[
"Highschooler"
] |
Show the ID of the high schooler named Kyle.
|
SELECT ID FROM Highschooler WHERE name = "Kyle"
|
easy
|
873 |
network_1
|
[
"Highschooler"
] |
What is Kyle's id?
|
SELECT ID FROM Highschooler WHERE name = "Kyle"
|
easy
|
874 |
network_1
|
[
"Highschooler"
] |
How many high schoolers are there in grade 9 or 10?
|
SELECT count(*) FROM Highschooler WHERE grade = 9 OR grade = 10
|
medium
|
875 |
network_1
|
[
"Highschooler"
] |
Count the number of high schoolers in grades 9 or 10.
|
SELECT count(*) FROM Highschooler WHERE grade = 9 OR grade = 10
|
medium
|
876 |
network_1
|
[
"Highschooler"
] |
Show the number of high schoolers for each grade.
|
SELECT grade , count(*) FROM Highschooler GROUP BY grade
|
medium
|
877 |
network_1
|
[
"Highschooler"
] |
How many high schoolers are in each grade?
|
SELECT grade , count(*) FROM Highschooler GROUP BY grade
|
medium
|
878 |
network_1
|
[
"Highschooler"
] |
Which grade has the most high schoolers?
|
SELECT grade FROM Highschooler GROUP BY grade ORDER BY count(*) DESC LIMIT 1
|
hard
|
879 |
network_1
|
[
"Highschooler"
] |
Return the grade that has the greatest number of high schoolers.
|
SELECT grade FROM Highschooler GROUP BY grade ORDER BY count(*) DESC LIMIT 1
|
hard
|
880 |
network_1
|
[
"Highschooler"
] |
Show me all grades that have at least 4 students.
|
SELECT grade FROM Highschooler GROUP BY grade HAVING count(*) >= 4
|
easy
|
881 |
network_1
|
[
"Highschooler"
] |
Which grades have 4 or more high schoolers?
|
SELECT grade FROM Highschooler GROUP BY grade HAVING count(*) >= 4
|
easy
|
882 |
network_1
|
[
"Friend"
] |
Show the student IDs and numbers of friends corresponding to each.
|
SELECT student_id , count(*) FROM Friend GROUP BY student_id
|
medium
|
883 |
network_1
|
[
"Friend"
] |
How many friends does each student have?
|
SELECT student_id , count(*) FROM Friend GROUP BY student_id
|
medium
|
884 |
network_1
|
[
"Friend",
"Highschooler"
] |
Show the names of high school students and their corresponding number of friends.
|
SELECT T2.name , count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
|
medium
|
885 |
network_1
|
[
"Friend",
"Highschooler"
] |
What are the names of the high schoolers and how many friends does each have?
|
SELECT T2.name , count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id
|
medium
|
886 |
network_1
|
[
"Friend",
"Highschooler"
] |
What is the name of the high schooler who has the greatest number of friends?
|
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
887 |
network_1
|
[
"Friend",
"Highschooler"
] |
Return the name of the high school student with the most friends.
|
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
888 |
network_1
|
[
"Friend",
"Highschooler"
] |
Show the names of high schoolers who have at least 3 friends.
|
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3
|
medium
|
889 |
network_1
|
[
"Friend",
"Highschooler"
] |
What are the names of high schoolers who have 3 or more friends?
|
SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id GROUP BY T1.student_id HAVING count(*) >= 3
|
medium
|
890 |
network_1
|
[
"Friend",
"Highschooler"
] |
Show the names of all of the high schooler Kyle's friends.
|
SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id JOIN Highschooler AS T3 ON T1.friend_id = T3.id WHERE T2.name = "Kyle"
|
hard
|
891 |
network_1
|
[
"Friend",
"Highschooler"
] |
Return the names of friends of the high school student Kyle.
|
SELECT T3.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id JOIN Highschooler AS T3 ON T1.friend_id = T3.id WHERE T2.name = "Kyle"
|
hard
|
892 |
network_1
|
[
"Friend",
"Highschooler"
] |
How many friends does the high school student Kyle have?
|
SELECT count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
|
medium
|
893 |
network_1
|
[
"Friend",
"Highschooler"
] |
Count the number of friends Kyle has.
|
SELECT count(*) FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id WHERE T2.name = "Kyle"
|
medium
|
894 |
network_1
|
[
"Friend",
"Highschooler"
] |
Show ids of all students who do not have any friends.
|
SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
|
hard
|
895 |
network_1
|
[
"Friend",
"Highschooler"
] |
What are the ids of high school students who do not have friends?
|
SELECT id FROM Highschooler EXCEPT SELECT student_id FROM Friend
|
hard
|
896 |
network_1
|
[
"Friend",
"Highschooler"
] |
Show names of all high school students who do not have any friends.
|
SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id
|
hard
|
897 |
network_1
|
[
"Friend",
"Highschooler"
] |
What are the names of students who have no friends?
|
SELECT name FROM Highschooler EXCEPT SELECT T2.name FROM Friend AS T1 JOIN Highschooler AS T2 ON T1.student_id = T2.id
|
hard
|
898 |
network_1
|
[
"Likes",
"Friend"
] |
Show the ids of high schoolers who have friends and are also liked by someone else.
|
SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes
|
hard
|
899 |
network_1
|
[
"Likes",
"Friend"
] |
What are the ids of students who both have friends and are liked?
|
SELECT student_id FROM Friend INTERSECT SELECT liked_id FROM Likes
|
hard
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.