query_id
int64
0
7k
database_id
stringclasses
140 values
table_id
sequencelengths
1
5
query
stringlengths
16
224
answer
stringlengths
18
577
difficulty
stringclasses
4 values
3,700
baseball_1
[ "home_game", "team" ]
Which team had the least number of attendances in home games in 1980?
SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;
extra
3,701
baseball_1
[ "home_game", "team" ]
Find the team that attended the least number of home games in 1980.
SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;
extra
3,702
baseball_1
[ "park" ]
List the names of states that have more than 2 parks.
SELECT state FROM park GROUP BY state HAVING count(*) > 2;
easy
3,703
baseball_1
[ "park" ]
Which states have more than 2 parks?
SELECT state FROM park GROUP BY state HAVING count(*) > 2;
easy
3,704
baseball_1
[ "team_franchise" ]
How many team franchises are active, with active value 'Y'?
SELECT count(*) FROM team_franchise WHERE active = 'Y';
easy
3,705
baseball_1
[ "team_franchise" ]
Find the number of team franchises that are active (have 'Y' as "active" information).
SELECT count(*) FROM team_franchise WHERE active = 'Y';
easy
3,706
baseball_1
[ "park" ]
Which cities have 2 to 4 parks?
SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;
easy
3,707
baseball_1
[ "park" ]
Find all the cities that have 2 to 4 parks.
SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;
easy
3,708
baseball_1
[ "home_game", "park" ]
Which park had most attendances in 2008?
SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;
extra
3,709
baseball_1
[ "home_game", "park" ]
Which park did the most people attend in 2008?
SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id = T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;
extra
3,710
mountain_photos
[ "camera_lens" ]
How many camera lenses have a focal length longer than 15 mm?
SELECT count(*) FROM camera_lens WHERE focal_length_mm > 15
easy
3,711
mountain_photos
[ "camera_lens" ]
Find the brand and name for each camera lens, and sort in descending order of maximum aperture.
SELECT brand , name FROM camera_lens ORDER BY max_aperture DESC
medium
3,712
mountain_photos
[ "photos" ]
List the id, color scheme, and name for all the photos.
SELECT id , color , name FROM photos
medium
3,713
mountain_photos
[ "mountain" ]
What are the maximum and average height of the mountains?
SELECT max(height) , avg(height) FROM mountain
medium
3,714
mountain_photos
[ "mountain" ]
What are the average prominence of the mountains in country 'Morocco'?
SELECT avg(prominence) FROM mountain WHERE country = 'Morocco'
easy
3,715
mountain_photos
[ "mountain" ]
What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'?
SELECT name , height , prominence FROM mountain WHERE range != 'Aberdare Range'
medium
3,716
mountain_photos
[ "mountain", "photos" ]
What are the id and name of the photos for mountains?
SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.height > 4000
medium
3,717
mountain_photos
[ "mountain", "photos" ]
What are the id and name of the mountains that have at least 2 photos?
SELECT T1.id , T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id GROUP BY T1.id HAVING count(*) >= 2
medium
3,718
mountain_photos
[ "photos", "camera_lens" ]
What are the names of the cameras that have taken picture of the most mountains?
SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id = T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1
extra
3,719
mountain_photos
[ "photos", "camera_lens" ]
What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'?
SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id = T1.id WHERE T1.brand = 'Sigma' OR T1.brand = 'Olympus'
hard
3,720
mountain_photos
[ "camera_lens" ]
How many different kinds of lens brands are there?
SELECT count(DISTINCT brand) FROM camera_lens
easy
3,721
mountain_photos
[ "photos", "camera_lens" ]
How many camera lenses are not used in taking any photos?
SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos )
extra
3,722
mountain_photos
[ "mountain", "photos" ]
How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'?
SELECT count(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id WHERE T1.country = 'Ethiopia'
medium
3,723
mountain_photos
[ "mountain", "camera_lens", "photos" ]
List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif'
SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T1.range = 'Lasta Massif'
extra
3,724
mountain_photos
[ "mountain", "camera_lens", "photos" ]
Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'.
SELECT name , prominence FROM mountain EXCEPT SELECT T1.name , T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id = T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id = T3.id WHERE T3.brand = 'Sigma'
extra
3,725
mountain_photos
[ "camera_lens" ]
List the camera lens names containing substring "Digital".
SELECT name FROM camera_lens WHERE name LIKE "%Digital%"
medium
3,726
mountain_photos
[ "photos", "camera_lens" ]
What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos.
SELECT T1.name , count(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id = T2.camera_lens_id GROUP BY T1.id ORDER BY count(*)
hard
3,727
program_share
[ "channel" ]
Find the names of channels that are not owned by CCTV.
SELECT name FROM channel WHERE OWNER != 'CCTV'
easy
3,728
program_share
[ "channel" ]
Which channels are not owned by CCTV? Give me the channel names.
SELECT name FROM channel WHERE OWNER != 'CCTV'
easy
3,729
program_share
[ "channel" ]
List all channel names ordered by their rating in percent from big to small.
SELECT name FROM channel ORDER BY rating_in_percent DESC
easy
3,730
program_share
[ "channel" ]
Give me a list of all the channel names sorted by the channel rating in descending order.
SELECT name FROM channel ORDER BY rating_in_percent DESC
easy
3,731
program_share
[ "channel" ]
What is the owner of the channel that has the highest rating ratio?
SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
medium
3,732
program_share
[ "channel" ]
Show me the owner of the channel with the highest rating.
SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1
medium
3,733
program_share
[ "program" ]
how many programs are there?
SELECT count(*) FROM program
easy
3,734
program_share
[ "program" ]
Count the number of programs.
SELECT count(*) FROM program
easy
3,735
program_share
[ "program" ]
list all the names of programs, ordering by launch time.
SELECT name FROM program ORDER BY launch
easy
3,736
program_share
[ "program" ]
What is the list of program names, sorted by the order of launch date?
SELECT name FROM program ORDER BY launch
easy
3,737
program_share
[ "program" ]
List the name, origin and owner of each program.
SELECT name , origin , OWNER FROM program
medium
3,738
program_share
[ "program" ]
What are the name, origin and owner of each program?
SELECT name , origin , OWNER FROM program
medium
3,739
program_share
[ "program" ]
find the name of the program that was launched most recently.
SELECT name FROM program ORDER BY launch DESC LIMIT 1
medium
3,740
program_share
[ "program" ]
Which program was launched most recently? Return the program name.
SELECT name FROM program ORDER BY launch DESC LIMIT 1
medium
3,741
program_share
[ "channel" ]
find the total percentage share of all channels owned by CCTV.
SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
easy
3,742
program_share
[ "channel" ]
What is the total share (in percent) of all the channels owned by CCTV?
SELECT sum(Share_in_percent) FROM channel WHERE OWNER = 'CCTV'
easy
3,743
program_share
[ "channel", "broadcast" ]
Find the names of the channels that are broadcast in the morning.
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
medium
3,744
program_share
[ "channel", "broadcast" ]
Which channels are broadcast in the morning? Give me the channel names.
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning'
medium
3,745
program_share
[ "channel", "broadcast" ]
what are the names of the channels that broadcast in both morning and night?
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'
extra
3,746
program_share
[ "channel", "broadcast" ]
Which channels broadcast both in the morning and at night? Give me the channel names.
SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id = t2.channel_id WHERE t2.time_of_day = 'Night'
extra
3,747
program_share
[ "broadcast" ]
how many programs are broadcast in each time section of the day?
SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
medium
3,748
program_share
[ "broadcast" ]
Count the number of programs broadcast for each time section of a day.
SELECT count(*) , time_of_day FROM broadcast GROUP BY time_of_day
medium
3,749
program_share
[ "broadcast" ]
find the number of different programs that are broadcast during night time.
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
easy
3,750
program_share
[ "broadcast" ]
How many distinct programs are broadcast at "Night" time?
SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day = 'Night'
easy
3,751
program_share
[ "program", "broadcast" ]
Find the names of programs that are never broadcasted in the morning.
SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning"
hard
3,752
program_share
[ "program", "broadcast" ]
Which programs are never broadcasted in the morning? Give me the names of the programs.
SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning"
hard
3,753
program_share
[ "program", "broadcast" ]
find the program owners that have some programs in both morning and night time.
SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Night"
extra
3,754
program_share
[ "program", "broadcast" ]
Who are the owners of the programs that broadcast both in the morning and at night?
SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id WHERE t2.Time_of_day = "Night"
extra
3,755
program_share
[ "program" ]
List all program origins in the alphabetical order.
SELECT origin FROM program ORDER BY origin
easy
3,756
program_share
[ "program" ]
What is the list of program origins ordered alphabetically?
SELECT origin FROM program ORDER BY origin
easy
3,757
program_share
[ "channel" ]
what is the number of different channel owners?
SELECT count(DISTINCT OWNER) FROM channel
easy
3,758
program_share
[ "channel" ]
Count the number of distinct channel owners.
SELECT count(DISTINCT OWNER) FROM channel
easy
3,759
program_share
[ "program" ]
find the names of programs whose origin is not in Beijing.
SELECT name FROM program WHERE origin != 'Beijing'
easy
3,760
program_share
[ "program" ]
Which programs' origins are not "Beijing"? Give me the program names.
SELECT name FROM program WHERE origin != 'Beijing'
easy
3,761
program_share
[ "channel" ]
What are the names of the channels owned by CCTV or HBS?
SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
medium
3,762
program_share
[ "channel" ]
List the names of all the channels owned by either CCTV or HBS
SELECT name FROM channel WHERE OWNER = 'CCTV' OR OWNER = 'HBS'
medium
3,763
program_share
[ "channel" ]
Find the total rating ratio for each channel owner.
SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
medium
3,764
program_share
[ "channel" ]
What is the total rating of channel for each channel owner?
SELECT sum(Rating_in_percent) , OWNER FROM channel GROUP BY OWNER
medium
3,765
program_share
[ "program", "broadcast" ]
Find the name of the program that is broadcast most frequently.
SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
extra
3,766
program_share
[ "program", "broadcast" ]
Which program is broadcast most frequently? Give me the program name.
SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id = t2.program_id GROUP BY t2.program_id ORDER BY count(*) DESC LIMIT 1
extra
3,767
e_learning
[ "COURSES" ]
How many courses are there in total?
SELECT count(*) FROM COURSES
easy
3,768
e_learning
[ "COURSES" ]
Find the total number of courses offered.
SELECT count(*) FROM COURSES
easy
3,769
e_learning
[ "COURSES" ]
What are the descriptions of the courses with name "database"?
SELECT course_description FROM COURSES WHERE course_name = "database"
easy
3,770
e_learning
[ "COURSES" ]
Return the description for the courses named "database".
SELECT course_description FROM COURSES WHERE course_name = "database"
easy
3,771
e_learning
[ "Course_Authors_and_Tutors" ]
What are the addresses of the course authors or tutors with personal name "Cathrine"
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
easy
3,772
e_learning
[ "Course_Authors_and_Tutors" ]
Return the addresses of the course authors or tutors whose personal name is "Cathrine".
SELECT address_line_1 FROM Course_Authors_and_Tutors WHERE personal_name = "Cathrine"
easy
3,773
e_learning
[ "Course_Authors_and_Tutors" ]
List the addresses of all the course authors or tutors.
SELECT address_line_1 FROM Course_Authors_and_Tutors
easy
3,774
e_learning
[ "Course_Authors_and_Tutors" ]
What is the address of each course author or tutor?
SELECT address_line_1 FROM Course_Authors_and_Tutors
easy
3,775
e_learning
[ "Course_Authors_and_Tutors" ]
List all the login names and family names of course author and tutors.
SELECT login_name , family_name FROM Course_Authors_and_Tutors
medium
3,776
e_learning
[ "Course_Authors_and_Tutors" ]
What are the login names and family names of course author and tutors?
SELECT login_name , family_name FROM Course_Authors_and_Tutors
medium
3,777
e_learning
[ "Student_Course_Enrolment" ]
List all the dates of enrollment and completion of students.
SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
medium
3,778
e_learning
[ "Student_Course_Enrolment" ]
What are all the dates of enrollment and completion in record?
SELECT date_of_enrolment , date_of_completion FROM Student_Course_Enrolment
medium
3,779
e_learning
[ "Student_Course_Enrolment" ]
How many distinct students are enrolled in courses?
SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
easy
3,780
e_learning
[ "Student_Course_Enrolment" ]
Find the number of distinct students enrolled in courses.
SELECT count(DISTINCT student_id) FROM Student_Course_Enrolment
easy
3,781
e_learning
[ "Student_Course_Enrolment" ]
How many distinct courses are enrolled in by students?
SELECT count(course_id) FROM Student_Course_Enrolment
easy
3,782
e_learning
[ "Student_Course_Enrolment" ]
Find the number of distinct courses that have enrolled students.
SELECT count(course_id) FROM Student_Course_Enrolment
easy
3,783
e_learning
[ "Student_Tests_Taken" ]
Find the dates of the tests taken with result "Pass".
SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
easy
3,784
e_learning
[ "Student_Tests_Taken" ]
Which tests have "Pass" results? Return the dates when the tests were taken.
SELECT date_test_taken FROM Student_Tests_Taken WHERE test_result = "Pass"
easy
3,785
e_learning
[ "Student_Tests_Taken" ]
How many tests have result "Fail"?
SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
easy
3,786
e_learning
[ "Student_Tests_Taken" ]
Count the number of tests with "Fail" result.
SELECT count(*) FROM Student_Tests_Taken WHERE test_result = "Fail"
easy
3,787
e_learning
[ "Students" ]
What are the login names of the students with family name "Ward"?
SELECT login_name FROM Students WHERE family_name = "Ward"
easy
3,788
e_learning
[ "Students" ]
Return the login names of the students whose family name is "Ward".
SELECT login_name FROM Students WHERE family_name = "Ward"
easy
3,789
e_learning
[ "Students" ]
What are the dates of the latest logon of the students with family name "Jaskolski" or "Langosh"?
SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
medium
3,790
e_learning
[ "Students" ]
Find the latest logon date of the students whose family name is "Jaskolski" or "Langosh".
SELECT date_of_latest_logon FROM Students WHERE family_name = "Jaskolski" OR family_name = "Langosh"
medium
3,791
e_learning
[ "Students" ]
How many students have personal names that contain the word "son"?
SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
medium
3,792
e_learning
[ "Students" ]
Find the number of students who have the word "son" in their personal names.
SELECT COUNT(*) FROM Students WHERE personal_name LIKE "%son%"
medium
3,793
e_learning
[ "SUBJECTS" ]
List all the subject names.
SELECT subject_name FROM SUBJECTS
easy
3,794
e_learning
[ "SUBJECTS" ]
What are the names of all the subjects.
SELECT subject_name FROM SUBJECTS
easy
3,795
e_learning
[ "Course_Authors_and_Tutors" ]
List all the information about course authors and tutors in alphabetical order of the personal name.
SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
easy
3,796
e_learning
[ "Course_Authors_and_Tutors" ]
Sort the information about course authors and tutors in alphabetical order of the personal name.
SELECT * FROM Course_Authors_and_Tutors ORDER BY personal_name
easy
3,797
e_learning
[ "Students" ]
List the personal names and family names of all the students in alphabetical order of family name.
SELECT personal_name , family_name FROM Students ORDER BY family_name
medium
3,798
e_learning
[ "Students" ]
What are the personal names and family names of the students? Sort the result in alphabetical order of the family name.
SELECT personal_name , family_name FROM Students ORDER BY family_name
medium
3,799
e_learning
[ "Student_Tests_Taken" ]
List each test result and its count in descending order of count.
SELECT test_result , COUNT(*) FROM Student_Tests_Taken GROUP BY test_result ORDER BY COUNT(*) DESC
extra