index
int32 0
1.03k
| db_id
stringclasses 20
values | question
stringlengths 18
174
| db_info
stringlengths 1
1.79k
| ground_truth
stringlengths 20
474
|
---|---|---|---|---|
0 |
concert_singer
|
How many singers do we have?
|
| singer: singer_id, name, country, song_name, song_release_year, age, is_male | stadium: stadium_id, name, location, capacity, highest, lowest, average | concert: concert_id, concert_name, theme, stadium_id, year | singer_in_concert: concert_id, singer_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select count ( * ) from singer
|
1 |
concert_singer
|
What is the total number of singers?
|
| singer: singer_id, name, country, song_name, song_release_year, age, is_male |
|
select count ( * ) from singer
|
2 |
concert_singer
|
Show name, country, age for all singers ordered by age from the oldest to the youngest.
|
| singer: name, country, age, singer_id, song_name, song_release_year, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average |
|
select name , country , age from singer order by age desc
|
3 |
concert_singer
|
What are the names, countries, and ages for every singer in descending order of age?
|
| singer: name, country, age, singer_id, song_name, song_release_year, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select name , country , age from singer order by age desc
|
4 |
concert_singer
|
What is the average, minimum, and maximum age of all singers from France?
|
| singer: country, age, singer_id, name, song_name, song_release_year, is_male |
|
select avg ( age ) , min ( age ) , max ( age ) from singer where country = 'France'
|
5 |
concert_singer
|
What is the average, minimum, and maximum age for all French singers?
|
| singer: country, age, singer_id, name, song_name, song_release_year | concert: concert_id | stadium: stadium_id | singer_in_concert: singer_id, concert_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select avg ( age ) , min ( age ) , max ( age ) from singer where country = 'France'
|
6 |
concert_singer
|
Show the name and the release year of the song by the youngest singer.
|
| singer: name, song_release_year, age, singer_id, country, is_male, song_name | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select song_name , song_release_year from singer order by age asc limit 1
|
7 |
concert_singer
|
What are the names and release years for all the songs of the youngest singer?
|
| singer: age, song_name, song_release_year, singer_id, name, country, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, year, theme, stadium_id, concert_name | stadium: stadium_id, name, location, capacity, highest, lowest, average | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select song_name , song_release_year from singer order by age asc limit 1
|
8 |
concert_singer
|
What are all distinct countries where singers above age 20 are from?
|
| singer: country, age, singer_id, name, song_name, song_release_year, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, stadium_id, concert_name, theme, year | stadium: stadium_id, location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select distinct country from singer where age > 20
|
9 |
concert_singer
|
What are the different countries with singers above age 20?
|
| singer: country, age, singer_id | singer_in_concert: singer_id, concert_id |
|
select distinct country from singer where age > 20
|
10 |
concert_singer
|
Show all countries and the number of singers in each country.
|
| singer: country, singer_id, name, song_name, song_release_year, age, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average |
|
select country , count ( * ) from singer group by country
|
11 |
concert_singer
|
How many singers are from each country?
|
| singer: singer_id, country, name, song_name, song_release_year, age, is_male | stadium: stadium_id, location, name, capacity, highest, lowest, average | concert: concert_id, concert_name, theme, stadium_id, year | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select country , count ( * ) from singer group by country
|
12 |
concert_singer
|
List all song names by singers above the average age.
|
| singer: name, age, song_name, country, song_release_year, is_male, singer_id | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select song_name from singer where age > ( select avg ( age ) from singer )
|
13 |
concert_singer
|
What are all the song names by singers who are older than average?
|
| singer: age, name, song_name, singer_id, country, song_release_year, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id | stadium: stadium_id |
|
select song_name from singer where age > ( select avg ( age ) from singer )
|
14 |
concert_singer
|
Show location and name for all stadiums with a capacity between 5000 and 10000.
|
| stadium: capacity, name, location, stadium_id, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select location , name from stadium where capacity between 5000 and 10000
|
15 |
concert_singer
|
What are the locations and names of all stations with capacity between 5000 and 10000?
|
| stadium: capacity, name, location, stadium_id, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: concert_id, singer_id |
|
select location , name from stadium where capacity between 5000 and 10000
|
16 |
concert_singer
|
What is the maximum capacity and the average of all stadiums ?
|
| stadium: capacity, average, stadium_id, location, name, highest, lowest | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert: concert_id, concert_name, theme, stadium_id, year | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select max ( capacity ) , average from stadium
|
17 |
concert_singer
|
What is the average and maximum capacities for all stadiums ?
|
| stadium: capacity, stadium_id, name, location, highest, lowest, average | singer: singer_id | concert: stadium_id, concert_id | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select avg ( capacity ) , max ( capacity ) from stadium
|
18 |
concert_singer
|
What is the name and capacity for the stadium with highest average attendance?
|
| stadium: average, name, capacity, stadium_id, location, highest, lowest | concert: stadium_id, concert_id, concert_name, theme, year | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select name , capacity from stadium order by average desc limit 1
|
19 |
concert_singer
|
What is the name and capacity for the stadium with the highest average attendance?
|
| stadium: average, name, capacity, stadium_id, highest, lowest, location | concert: stadium_id, concert_id, concert_name, theme, year | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: singer_id, concert_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select name , capacity from stadium order by average desc limit 1
|
20 |
concert_singer
|
How many concerts are there in year 2014 or 2015?
|
| concert: year, concert_id, concert_name, theme, stadium_id | singer_in_concert: concert_id | singer: | stadium: |
|
select count ( * ) from concert where year = 2014 or year = 2015
|
21 |
concert_singer
|
How many concerts occurred in 2014 or 2015?
|
| concert: year, concert_id, concert_name, theme, stadium_id | stadium: stadium_id, location, name, capacity, highest, lowest, average | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: concert_id, singer_id |
|
select count ( * ) from concert where year = 2014 or year = 2015
|
22 |
concert_singer
|
Show the stadium name and the number of concerts in each stadium.
|
| stadium: name, stadium_id | concert: stadium_id, concert_id | singer: | singer_in_concert: |
|
select stadium.name , count ( * ) from concert join stadium on concert.stadium_id = stadium.stadium_id group by concert.stadium_id
|
23 |
concert_singer
|
For each stadium, how many concerts play there?
|
| stadium: stadium_id, name, location, capacity, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: concert_id, singer_id |
|
select stadium.name , count ( * ) from concert join stadium on concert.stadium_id = stadium.stadium_id group by concert.stadium_id
|
24 |
concert_singer
|
Show the stadium name and capacity with most number of concerts in year 2014 or after.
|
| concert: year, stadium_id, concert_id, concert_name, theme | stadium: name, capacity, stadium_id, location, highest, lowest, average | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select stadium.name , stadium.capacity from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year >= 2014 group by stadium.stadium_id order by count ( * ) desc limit 1
|
25 |
concert_singer
|
What is the name and capacity of the stadium with the most concerts after 2013 ?
|
| stadium: stadium_id, name, capacity, location, highest, lowest, average | concert: stadium_id, year, concert_id, concert_name, theme | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select stadium.name , stadium.capacity from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year > 2013 group by stadium.stadium_id order by count ( * ) desc limit 1
|
26 |
concert_singer
|
Which year has most number of concerts?
|
| concert: year, concert_id | singer_in_concert: concert_id |
|
select year from concert group by year order by count ( * ) desc limit 1
|
27 |
concert_singer
|
What is the year that had the most concerts?
|
| concert: year, concert_id, concert_name, theme, stadium_id | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male | stadium: stadium_id, location, name, capacity, highest, lowest, average | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select year from concert group by year order by count ( * ) desc limit 1
|
28 |
concert_singer
|
Show the stadium names without any concert.
|
| stadium: stadium_id, name, location, capacity, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer_in_concert: - | singer: - |
|
select name from stadium where stadium_id not in ( select stadium_id from concert )
|
29 |
concert_singer
|
What are the names of the stadiums without any concerts?
|
| stadium: name, stadium_id, location, capacity, highest, lowest, average | singer: | concert: stadium_id, concert_id, concert_name, theme, year | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select name from stadium where stadium_id not in ( select stadium_id from concert )
|
30 |
concert_singer
|
Show countries where a singer above age 40 and a singer below 30 are from.
|
| singer: country, age, singer_id, name, song_name, song_release_year, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium: stadium_id, location, name, capacity, highest, lowest, average |
|
select country from singer where age > 40 intersect select country from singer where age < 30
|
31 |
concert_singer
|
Show names for all stadiums except for stadiums having a concert in year 2014.
|
| stadium: stadium_id, name, location, capacity, highest, lowest, average | concert: stadium_id, year, concert_id, concert_name, theme | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male |
|
select name from stadium except select stadium.name from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2014
|
32 |
concert_singer
|
What are the names of all stadiums that did not have a concert in 2014?
|
| stadium: name, stadium_id | concert: stadium_id, year | singer_in_concert: | singer: | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select name from stadium except select stadium.name from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2014
|
33 |
concert_singer
|
Show the name and theme for all concerts and the number of singers in each concert.
|
| concert: concert_name, theme | singer_in_concert: concert_id, singer_id | stadium: stadium_id, location, name, capacity, highest, lowest, average | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select concert.concert_name , concert.theme , count ( * ) from singer_in_concert join concert on singer_in_concert.concert_id = concert.concert_id group by concert.concert_id
|
34 |
concert_singer
|
What are the names , themes , and number of singers for every concert ?
|
| concert: concert_name, theme, concert_id, stadium_id | singer_in_concert: concert_id, singer_id | singer: name, singer_id | stadium: stadium_id |
|
select concert.concert_name , concert.theme , count ( * ) from singer_in_concert join concert on singer_in_concert.concert_id = concert.concert_id group by concert.concert_id
|
35 |
concert_singer
|
List singer names and number of concerts for each singer.
|
| singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id | stadium: stadium_id, location, name, capacity, highest, lowest, average |
|
select singer.name , count ( * ) from singer_in_concert join singer on singer_in_concert.singer_id = singer.singer_id group by singer.singer_id
|
36 |
concert_singer
|
What are the names of the singers and number of concerts for each person?
|
| singer: name, singer_id, country, song_name, song_release_year, age, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium : stadium_id, location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select singer.name , count ( * ) from singer_in_concert join singer on singer_in_concert.singer_id = singer.singer_id group by singer.singer_id
|
37 |
concert_singer
|
List all singer names in concerts in year 2014.
|
| concert: year, concert_id | singer_in_concert: concert_id, singer_id | singer: singer_id, name | stadium: stadium_id | singer: country, song_name, song_release_year, age, is_male | concert: concert_name, theme, stadium_id | stadium: location, name, capacity, highest, lowest, average |
|
select singer.name from singer_in_concert join singer on singer_in_concert.singer_id = singer.singer_id join concert on singer_in_concert.concert_id = concert.concert_id where concert.year = 2014
|
38 |
concert_singer
|
What are the names of the singers who performed in a concert in 2014?
|
| concert: year, concert_id, concert_name, theme | singer_in_concert: concert_id, singer_id | singer: name, singer_id, country, song_name, song_release_year, age, is_male | stadium: stadium_id, location, name, capacity, highest, lowest, average | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select singer.name from singer_in_concert join singer on singer_in_concert.singer_id = singer.singer_id join concert on singer_in_concert.concert_id = concert.concert_id where concert.year = 2014
|
39 |
concert_singer
|
what is the name and nation of the singer who have a song having 'Hey' in its name?
|
| singer: song_name, name, country, singer_id, song_release_year, age, is_male | singer_in_concert: singer_id, concert_id | concert: concert_id, concert_name, theme, stadium_id, year | stadium : stadium_id, location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select name , country from singer where song_name like '%Hey%'
|
40 |
concert_singer
|
What is the name and country of origin of every singer who has a song with the word 'Hey' in its title?
|
| singer: name, country, song_name, singer_id | singer_in_concert: singer_id, concert_id | concert: concert_id, stadium_id | stadium: stadium_id | singer: age, is_male, song_release_year | concert: concert_name, theme, year | stadium: location, name, capacity, highest, lowest, average | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id | concert.stadium_id = stadium.stadium_id |
|
select name , country from singer where song_name like '%Hey%'
|
41 |
concert_singer
|
Find the name and location of the stadiums which some concerts happened in the years of both 2014 and 2015.
|
| stadium: name, stadium_id, location, capacity, highest, lowest, average | concert: year, stadium_id, concert_id, concert_name, theme | singer: singer_id, song_release_year, name, country, age, is_male, song_name | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select stadium.name , stadium.location from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2014 intersect select stadium.name , stadium.location from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2015
|
42 |
concert_singer
|
What are the names and locations of the stadiums that had concerts that occurred in both 2014 and 2015?
|
| concert: year, stadium_id, concert_id, concert_name, theme | stadium: name, location, stadium_id, capacity, highest, lowest, average | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.concert_id = concert.concert_id |
|
select stadium.name , stadium.location from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2014 intersect select stadium.name , stadium.location from concert join stadium on concert.stadium_id = stadium.stadium_id where concert.year = 2015
|
43 |
concert_singer
|
Find the number of concerts happened in the stadium with the highest capacity .
|
| stadium: capacity, stadium_id, location, name, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer: singer_id, name, country, song_name, song_release_year, age, is_male | singer_in_concert: concert_id, singer_id | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select count ( * ) from concert where stadium_id = ( select stadium_id from stadium order by capacity desc limit 1 )
|
44 |
concert_singer
|
What are the number of concerts that occurred in the stadium with the largest capacity ?
|
| stadium: capacity, stadium_id, location, name, highest, lowest, average | concert: stadium_id, concert_id, concert_name, theme, year | singer_in_concert: concert_id, singer_id | singer: singer_id, name, country, song_name, song_release_year, age, is_male | concert.stadium_id = stadium.stadium_id | singer_in_concert.singer_id = singer.singer_id | singer_in_concert.concert_id = concert.concert_id |
|
select count ( * ) from concert where stadium_id = ( select stadium_id from stadium order by capacity desc limit 1 )
|
45 |
pets_1
|
Find the number of pets whose weight is heavier than 10.
|
| pets: weight, petid | has_pet: petid, stuid | student: stuid |
|
select count ( * ) from pets where weight > 10
|
46 |
pets_1
|
How many pets have a greater weight than 10?
|
| pets: weight, petid | has_pet: petid, stuid | student: stuid | has_pet.petid = pets.petid | has_pet.stuid = student.stuid |
|
select count ( * ) from pets where weight > 10
|
47 |
pets_1
|
Find the weight of the youngest dog.
|
| pets: pet_age, weight, petid, pettype | has_pet: petid, stuid | student: stuid |
|
select weight from pets order by pet_age asc limit 1
|
48 |
pets_1
|
How much does the youngest dog weigh?
|
| student: stuid, age, lname, fname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: weight, pet_age, pettype, petid | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select weight from pets order by pet_age asc limit 1
|
49 |
pets_1
|
Find the maximum weight for each type of pet. List the maximum weight and pet type.
|
| pets: weight, pettype, petid | has_pet: petid, stuid | student: stuid |
|
select max ( weight ) , pettype from pets group by pettype
|
50 |
pets_1
|
List the maximum weight and type for each type of pet.
|
| pets: pettype, weight, petid, pet_age | has_pet: petid, stuid | student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select max ( weight ) , pettype from pets group by pettype
|
51 |
pets_1
|
Find number of pets owned by students who are older than 20.
|
| student: stuid, age | has_pet: stuid, petid | pets: petid |
|
select count ( * ) from student join has_pet on student.stuid = has_pet.stuid where student.age > 20
|
52 |
pets_1
|
How many pets are owned by students that have an age greater than 20?
|
| student: stuid, age, lname, fname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid=student.stuid | has_pet.petid=pets.petid |
|
select count ( * ) from student join has_pet on student.stuid = has_pet.stuid where student.age > 20
|
53 |
pets_1
|
Find the number of dog pets that are raised by female students (with sex F).
|
| student: sex, stuid | has_pet: stuid, petid | pets: pettype, petid |
|
select count ( * ) from student join has_pet on student.stuid = has_pet.stuid join pets on has_pet.petid = pets.petid where student.sex = 'F' and pets.pettype = 'dog'
|
54 |
pets_1
|
How many dog pets are raised by female students?
|
| student: sex, stuid, lname, fname, age, major, advisor, city_code | has_pet: stuid, petid | pets: pettype, petid, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select count ( * ) from student join has_pet on student.stuid = has_pet.stuid join pets on has_pet.petid = pets.petid where student.sex = 'F' and pets.pettype = 'dog'
|
55 |
pets_1
|
Find the number of distinct type of pets.
|
| pets: pettype, petid, pet_age, weight | has_pet: petid, stuid | student: stuid, lname, fname, age, sex, major, advisor, city_code |
|
select count ( distinct pettype ) from pets
|
56 |
pets_1
|
How many different types of pet are there?
|
| pets: pettype, petid, pet_age, weight | has_pet: petid, stuid | student: stuid, lname, fname, age, sex, major, advisor, city_code |
|
select count ( distinct pettype ) from pets
|
57 |
pets_1
|
Find the first name of students who have cat or dog pet.
|
| student: stuid, fname, lname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: pettype, petid, pet_age, weight |
|
select distinct student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' or pets.pettype = 'dog'
|
58 |
pets_1
|
What are the first names of every student who has a cat or dog as a pet?
|
| student: stuid, fname, lname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select distinct student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' or pets.pettype = 'dog'
|
59 |
pets_1
|
Find the first name of students who have both cat and dog pets .
|
| student: stuid, fname | has_pet: stuid, petid | pets: petid, pettype | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' intersect select student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'dog'
|
60 |
pets_1
|
What are the students' first names who have both cats and dogs as pets?
|
| student: stuid, fname, lname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' intersect select student.fname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'dog'
|
61 |
pets_1
|
Find the major and age of students who do not have a cat pet.
|
| student: major, age, stuid, lname, fname, sex, advisor, city_code | has_pet: stuid, petid | pets: pettype, petid, pet_age, weight | has_pet.stuid=student.stuid | has_pet.petid=pets.petid |
|
select major , age from student where stuid not in ( select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' )
|
62 |
pets_1
|
What major is every student who does not own a cat as a pet, and also how old are they?
|
| student: stuid, age, major, lname, fname, sex, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select major , age from student where stuid not in ( select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' )
|
63 |
pets_1
|
Find the id of students who do not have a cat pet.
|
| student: stuid | has_pet: stuid, petid | pets: petid, pettype |
|
select stuid from student except select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat'
|
64 |
pets_1
|
What are the ids of the students who do not own cats as pets?
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select stuid from student except select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat'
|
65 |
pets_1
|
Find the first name and age of students who have a dog but do not have a cat as a pet.
|
| student: stuid, fname, age, lname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname , student.age from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'dog' and student.stuid not in ( select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' )
|
66 |
pets_1
|
What is the first name of every student who has a dog but does not have a cat?
|
| student: fname, stuid | has_pet: stuid, petid | pets: petid, pettype | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname , student.age from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'dog' and student.stuid not in ( select student.stuid from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pettype = 'cat' )
|
67 |
pets_1
|
Find the type and weight of the youngest pet.
|
| student: stuid | has_pet: stuid, petid | pets: petid, pet_age, pettype, weight |
|
select pettype , weight from pets order by pet_age asc limit 1
|
68 |
pets_1
|
What type of pet is the youngest animal, and how much does it weigh?
|
| pets: pet_age, pettype, weight, petid | has_pet: petid, stuid | student: stuid |
|
select pettype , weight from pets order by pet_age asc limit 1
|
69 |
pets_1
|
Find the id and weight of all pets whose age is older than 1.
|
| pets: pet_age, petid, weight, pettype | student: stuid, age, lname, fname, sex, major, advisor, city_code | has_pet: stuid, petid |
|
select petid , weight from pets where pet_age > 1
|
70 |
pets_1
|
What is the id and weight of every pet who is older than 1?
|
| pets: petid, pet_age, weight | has_pet: petid, stuid | student: stuid | has_pet.petid = pets.petid | has_pet.stuid = student.stuid |
|
select petid , weight from pets where pet_age > 1
|
71 |
pets_1
|
Find the average and maximum age for each type of pet.
|
| pets: pettype, pet_age, petid | has_pet: petid, stuid | student: stuid |
|
select avg ( pet_age ) , max ( pet_age ) , pettype from pets group by pettype
|
72 |
pets_1
|
What is the average and maximum age for each pet type?
|
| pets: pettype, pet_age, petid, weight | has_pet: petid, stuid | student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select avg ( pet_age ) , max ( pet_age ) , pettype from pets group by pettype
|
73 |
pets_1
|
Find the average weight for each pet type.
|
| pets: pettype, weight, petid, pet_age | has_pet: petid, stuid | student: stuid |
|
select avg ( weight ) , pettype from pets group by pettype
|
74 |
pets_1
|
What is the average weight for each type of pet?
|
| pets: weight, pettype, petid, pet_age | has_pet: stuid, petid | student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select avg ( weight ) , pettype from pets group by pettype
|
75 |
pets_1
|
Find the first name and age of students who have a pet.
|
| student: stuid, fname, age | has_pet: stuid, petid | pets: petid | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select distinct student.fname , student.age from student join has_pet on student.stuid = has_pet.stuid
|
76 |
pets_1
|
What are the different first names and ages of the students who do have pets?
|
| student: stuid, fname, age, lname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select distinct student.fname , student.age from student join has_pet on student.stuid = has_pet.stuid
|
77 |
pets_1
|
Find the id of the pet owned by student whose last name is ‘Smith’.
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid=student.stuid | has_pet.petid=pets.petid |
|
select has_pet.petid from student join has_pet on student.stuid = has_pet.stuid where student.lname = 'Smith'
|
78 |
pets_1
|
What is the id of the pet owned by the student whose last name is 'Smith'?
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | student.stuid = has_pet.stuid | has_pet.petid = pets.petid |
|
select has_pet.petid from student join has_pet on student.stuid = has_pet.stuid where student.lname = 'Smith'
|
79 |
pets_1
|
Find the number of pets for each student who has any pet and student id.
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight |
|
select count ( * ) , student.stuid from student join has_pet on student.stuid = has_pet.stuid group by student.stuid
|
80 |
pets_1
|
For students who have pets , how many pets does each student have ? list their ids instead of names .
|
| student: stuid | has_pet: stuid, petid | pets: petid |
|
select count ( * ) , student.stuid from student join has_pet on student.stuid = has_pet.stuid group by student.stuid
|
81 |
pets_1
|
Find the first name and gender of student who have more than one pet.
|
| student: stuid, fname, sex, lname, age, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname , student.sex from student join has_pet on student.stuid = has_pet.stuid group by student.stuid having count ( * ) > 1
|
82 |
pets_1
|
What is the first name and gender of the all the students who have more than one pet?
|
| student: stuid, fname, sex, lname, age, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.fname , student.sex from student join has_pet on student.stuid = has_pet.stuid group by student.stuid having count ( * ) > 1
|
83 |
pets_1
|
Find the last name of the student who has a cat that is age 3.
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select student.lname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pet_age = 3 and pets.pettype = 'cat'
|
84 |
pets_1
|
What is the last name of the student who has a cat that is 3 years old?
|
| student: stuid, lname, fname, age, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | student.stuid = has_pet.stuid | has_pet.petid = pets.petid |
|
select student.lname from student join has_pet on student.stuid = has_pet.stuid join pets on pets.petid = has_pet.petid where pets.pet_age = 3 and pets.pettype = 'cat'
|
85 |
pets_1
|
Find the average age of students who do not have any pet .
|
| student: stuid, age, lname, fname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight |
|
select avg ( age ) from student where stuid not in ( select stuid from has_pet )
|
86 |
pets_1
|
What is the average age for all students who do not own any pets ?
|
| student: stuid, age, lname, fname, sex, major, advisor, city_code | has_pet: stuid, petid | pets: petid, pettype, pet_age, weight | has_pet.stuid = student.stuid | has_pet.petid = pets.petid |
|
select avg ( age ) from student where stuid not in ( select stuid from has_pet )
|
87 |
car_1
|
How many continents are there?
|
| continents: continent, contid | countries: continent, countryid, countryname | car_makers: country, id, maker, fullname | model_list: maker, modelid, model | car_names: model, makeid, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select count ( * ) from continents
|
88 |
car_1
|
What is the number of continents?
|
| continents: continent, contid | countries: countryid, countryname, continent | car_makers: id, maker, fullname, country | model_list: modelid, maker, model | car_names: makeid, model, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select count ( * ) from continents
|
89 |
car_1
|
How many countries does each continent have? List the continent id, continent name and the number of countries.
|
| continents: contid, continent | countries: countryid, continent | car_makers: id, maker, fullname, country | model_list: modelid, maker, model | car_names: makeid, model, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select continents.contid , continents.continent , count ( * ) from continents join countries on continents.contid = countries.continent group by continents.contid
|
90 |
car_1
|
For each continent, list its id, name, and how many countries it has?
|
| continents: contid, continent | countries: continent, countryid, countryname | car_makers: country, id, maker, fullname | model_list: maker, modelid, model | car_names: model, makeid, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select continents.contid , continents.continent , count ( * ) from continents join countries on continents.contid = countries.continent group by continents.contid
|
91 |
car_1
|
How many countries are listed?
|
| countries: countryname, countryid, continent | continents: contid, continent | car_makers: country, id, maker, fullname | model_list: modelid, maker, model | car_names: makeid, model, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select count ( * ) from countries
|
92 |
car_1
|
How many countries exist?
|
| countries: countryname, countryid, continent | continents: contid, continent | car_makers: country, id, maker, fullname | model_list: maker, modelid, model | car_names: model, makeid, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select count ( * ) from countries
|
93 |
car_1
|
How many models does each car maker produce? List maker full name, id and the number.
|
| car_makers: fullname, id, maker, country | model_list: maker, model | countries: countryid, countryname | continents: contid, continent | car_names: makeid, model, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select car_makers.fullname , car_makers.id , count ( * ) from car_makers join model_list on car_makers.id = model_list.maker group by car_makers.id
|
94 |
car_1
|
What is the full name of each car maker, along with its id and how many models it produces?
|
| car_makers: id, fullname, maker, country | model_list: maker, modelid, model | countries: countryid, countryname, continent | continents: contid, continent | car_names: makeid, model, make | cars_data: id, mpg, cylinders, edispl, horsepower, weight, accelerate, year | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select car_makers.fullname , car_makers.id , count ( * ) from car_makers join model_list on car_makers.id = model_list.maker group by car_makers.id
|
95 |
car_1
|
Which model of the car has the minimum horsepower?
|
| cars_data: horsepower, id | car_names: makeid, model | model_list: model, maker | car_makers: id | countries: countryid | continents: contid | cars_data.id = car_names.makeid | car_names.model = model_list.model | model_list.maker = car_makers.id | car_makers.country = countries.countryid | countries.continent = continents.contid |
|
select car_names.model from car_names join cars_data on car_names.makeid = cars_data.id order by cars_data.horsepower asc limit 1
|
96 |
car_1
|
What is the model of the car with the smallest amount of horsepower?
|
| cars_data: horsepower, id | car_names: makeid, model | model_list: model, modelid, maker | car_makers: id | countries: countryid | continents: contid | cars_data.id = car_names.makeid | car_names.model = model_list.model | model_list.maker = car_makers.id | car_makers.country = countries.countryid | countries.continent = continents.contid |
|
select car_names.model from car_names join cars_data on car_names.makeid = cars_data.id order by cars_data.horsepower asc limit 1
|
97 |
car_1
|
Find the model of the car whose weight is below the average weight.
|
| cars_data: weight, id | car_names: model, makeid | model_list: model, maker | car_makers: id | countries: | continents: |
|
select car_names.model from car_names join cars_data on car_names.makeid = cars_data.id where cars_data.weight < ( select avg ( weight ) from cars_data )
|
98 |
car_1
|
What is the model for the car with a weight smaller than the average?
|
| cars_data: weight, id | car_names: model, makeid | model_list: model, modelid, maker | car_makers: id | countries: countryid, countryname, continent | continents: contid, continent | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select car_names.model from car_names join cars_data on car_names.makeid = cars_data.id where cars_data.weight < ( select avg ( weight ) from cars_data )
|
99 |
car_1
|
Find the name of the makers that produced some cars in the year of 1970?
|
| car_makers: id, maker, country, fullname | cars_data: id, year, mpg, cylinders, edispl, horsepower, weight, accelerate | model_list: maker, modelid, model | car_names: makeid, model, make | countries: countryid, countryname, continent | continents: contid, continent | countries.continent = continents.contid | car_makers.country = countries.countryid | model_list.maker = car_makers.id | car_names.model = model_list.model | cars_data.id = car_names.makeid |
|
select distinct car_makers.maker from car_makers join model_list on car_makers.id = model_list.maker join car_names on model_list.model = car_names.model join cars_data on car_names.makeid = cars_data.id where cars_data.year = '1970'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.