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
400
course_teach
What is the name of each teacher and what course they teach?
| course: course, course_id, starting_date | teacher: name, teacher_id, age, hometown | course_arrange: course_id, teacher_id, grade | course_arrange.course_id = course.course_id | course_arrange.teacher_id = teacher.teacher_id |
select teacher.name , course.course from course_arrange join course on course_arrange.course_id = course.course_id join teacher on course_arrange.teacher_id = teacher.teacher_id
401
course_teach
Show names of teachers and the courses they are arranged to teach in ascending alphabetical order of the teacher's name.
| teacher: name, teacher_id | course: course, course_id | course_arrange: teacher_id, course_id, grade | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select teacher.name , course.course from course_arrange join course on course_arrange.course_id = course.course_id join teacher on course_arrange.teacher_id = teacher.teacher_id order by teacher.name asc
402
course_teach
What are the names of the teachers and the courses they teach in ascending alphabetical order by the name of the teacher?
| teacher: name, teacher_id, age, hometown | course: course, course_id, staring_date | course_arrange: teacher_id, course_id, grade | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select teacher.name , course.course from course_arrange join course on course_arrange.course_id = course.course_id join teacher on course_arrange.teacher_id = teacher.teacher_id order by teacher.name asc
403
course_teach
Show the name of the teacher for the math course.
| course: course, course_id, staring_date | teacher: name, teacher_id, age, hometown | course_arrange: course_id, teacher_id, grade | course_arrange.course_id = course.course_id | course_arrange.teacher_id = teacher.teacher_id |
select teacher.name from course_arrange join course on course_arrange.course_id = course.course_id join teacher on course_arrange.teacher_id = teacher.teacher_id where course.course = 'Math'
404
course_teach
What are the names of the people who teach math courses?
| course: course, course_id, staring_date | teacher: name, teacher_id, age, hometown | course_arrange: teacher_id, course_id, grade | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select teacher.name from course_arrange join course on course_arrange.course_id = course.course_id join teacher on course_arrange.teacher_id = teacher.teacher_id where course.course = 'Math'
405
course_teach
Show names of teachers and the number of courses they teach.
| teacher: name, teacher_id, age, hometown | course_arrange: teacher_id, course_id, grade | course: course_id, staring_date, course |
select teacher.name , count ( * ) from course_arrange join teacher on course_arrange.teacher_id = teacher.teacher_id group by teacher.name
406
course_teach
What are the names of the teachers and how many courses do they teach?
| teacher: name, teacher_id, age, hometown | course_arrange: course_id, teacher_id, grade | course: course_id, starting_date, course | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select teacher.name , count ( * ) from course_arrange join teacher on course_arrange.teacher_id = teacher.teacher_id group by teacher.name
407
course_teach
Show names of teachers that teach at least two courses.
| course: course_id, course, staring_date | teacher: teacher_id, name, age, hometown | course_arrange: teacher_id, course_id, grade |
select teacher.name from course_arrange join teacher on course_arrange.teacher_id = teacher.teacher_id group by teacher.name having count ( * ) >= 2
408
course_teach
What are the names of the teachers who teach at least two courses?
| course: course_id, course, starting_date | teacher: teacher_id, name, age, hometown | course_arrange: teacher_id, course_id, grade | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select teacher.name from course_arrange join teacher on course_arrange.teacher_id = teacher.teacher_id group by teacher.name having count ( * ) >= 2
409
course_teach
List the names of teachers who have not been arranged to teach courses.
| teacher: name, teacher_id, age, hometown | course_arrange: teacher_id, course_id, grade | course: course_id, starting_date, course |
select name from teacher where teacher_id not in ( select teacher_id from course_arrange )
410
course_teach
What are the names of the teachers whose courses have not been arranged?
| teacher: name, teacher_id, age, hometown | course_arrange: teacher_id, course_id, grade | course: course_id, staring_date, course | course_arrange.teacher_id = teacher.teacher_id | course_arrange.course_id = course.course_id |
select name from teacher where teacher_id not in ( select teacher_id from course_arrange )
411
museum_visit
How many visitors below age 30 are there?
| visitor: age, id | visit: visitor_id | museum: museum_id | visit.museum_id = museum.museum_id | visit.visitor_id = visitor.id |
select count ( * ) from visitor where age < 30
412
museum_visit
Find the names of the visitors whose membership level is higher than 4, and order the results by the level from high to low.
| visitor: level_of_membership, name, id | visit: visitor_id, museum_id, num_of_ticket, total_spent | museum: museum_id, name, num_of_staff, open_year |
select name from visitor where level_of_membership > 4 order by level_of_membership desc
413
museum_visit
What is the average age of the visitors whose membership level is not higher than 4?
| museum: museum_id, name, num_of_staff, open_year | visitor: level_of_membership, age, id, name | visit: visitor_id, museum_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select avg ( age ) from visitor where level_of_membership <= 4
414
museum_visit
Find the name and membership level of the visitors whose membership level is higher than 4, and sort by their age from old to young.
| visitor: level_of_membership, name, age, id | visit: visitor_id, museum_id, num_of_ticket, total_spent | museum: museum_id, name, num_of_staff, open_year | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select name , level_of_membership from visitor where level_of_membership > 4 order by age desc
415
museum_visit
Find the id and name of the museum that has the most staff members?
| museum: museum_id, num_of_staff, name | visitor: id | visit: museum_id, visitor_id |
select museum_id , name from museum order by num_of_staff desc limit 1
416
museum_visit
Find the average number of staff working for the museums that were open before 2009.
| museum: open_year, num_of_staff, museum_id, name | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select avg ( num_of_staff ) from museum where open_year < 2009
417
museum_visit
What are the opening year and staff number of the museum named Plaza Museum?
| museum: name, open_year, num_of_staff, museum_id | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select num_of_staff , open_year from museum where name = 'Plaza Museum'
418
museum_visit
find the names of museums which have more staff than the minimum staff number of all museums opened after 2010.
| museum: num_of_staff, open_year, name, museum_id | visit: museum_id | visitor: |
select name from museum where num_of_staff > ( select min ( num_of_staff ) from museum where open_year > 2010 )
419
museum_visit
find the id, name and age for visitors who visited some museums more than once.
| museum: museum_id, name, num_of_staff, open_year | visitor: id, name, age, level_of_membership | visit: visitor_id, museum_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select visitor.id , visitor.name , visitor.age from visitor join visit on visitor.id = visit.visitor_id group by visitor.id having count ( * ) > 1
420
museum_visit
What are the id, name and membership level of visitors who have spent the largest amount of money in total in all museum tickets?
| visit: total_spent, visitor_id, num_of_ticket, museum_id | visitor: id, name, level_of_membership, age | museum: museum_id, name, num_of_staff, open_year | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select visit.visitor_id , visitor.name , visitor.level_of_membership from visitor join visit on visitor.id = visit.visitor_id group by visit.visitor_id order by sum ( visit.total_spent ) desc limit 1
421
museum_visit
What are the id and name of the museum visited most times?
| museum: museum_id, name, num_of_staff, open_year | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select visit.museum_id , museum.name from museum join visit on museum.museum_id = visit.museum_id group by visit.museum_id order by count ( * ) desc limit 1
422
museum_visit
What is the name of the museum that had no visitor yet?
| museum: museum_id, name, num_of_staff, open_year | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select name from museum where museum_id not in ( select museum_id from visit )
423
museum_visit
Find the name and age of the visitor who bought the most tickets at once.
| visitor: name, age, id, level_of_membership | visit: visitor_id, num_of_ticket, museum_id | museum: museum_id, name, num_of_staff, open_year | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select visitor.name , visitor.age from visitor join visit on visitor.id = visit.visitor_id order by visit.num_of_ticket desc limit 1
424
museum_visit
What are the average and maximum number of tickets bought in all visits?
| visit: num_of_ticket, museum_id, visitor_id, total_spent | visitor: id, name, level_of_membership, age | museum: museum_id, name, num_of_staff, open_year | visit.visitor_id=visitor.id | visit.museum_id=museum.museum_id |
select avg ( num_of_ticket ) , max ( num_of_ticket ) from visit
425
museum_visit
What is the total ticket expense of the visitors whose membership level is 1?
| visitor: level_of_membership, id | visit: total_spent, visitor_id | museum: museum_id |
select sum ( visit.total_spent ) from visitor join visit on visitor.id = visit.visitor_id where visitor.level_of_membership = 1
426
museum_visit
What is the name of the visitor who visited both a museum opened before 2009 and a museum opened after 2011?
| museum: museum_id, open_year, name, num_of_staff | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select visitor.name from visitor join visit on visitor.id = visit.visitor_id join museum on museum.museum_id = visit.museum_id where museum.open_year < 2009 intersect select visitor.name from visitor join visit on visitor.id = visit.visitor_id join museum on museum.museum_id = visit.museum_id where museum.open_year > 2011
427
museum_visit
Find the number of visitors who did not visit any museum opened after 2010.
| visitor: id | visit: visitor_id, museum_id, num_of_ticket, total_spent | museum: open_year, museum_id, name, num_of_staff |
select count ( * ) from visitor where id not in ( select visit.visitor_id from museum join visit on museum.museum_id = visit.museum_id where museum.open_year > 2010 )
428
museum_visit
How many museums were opened after 2013 or before 2008?
| museum: open_year, museum_id, name, num_of_staff | visitor: id, name, level_of_membership, age | visit: museum_id, visitor_id, num_of_ticket, total_spent | visit.visitor_id = visitor.id | visit.museum_id = museum.museum_id |
select count ( * ) from museum where open_year > 2013 or open_year < 2008
429
wta_1
Find the total number of players.
| players: player_id, first_name, last_name, hand, birth_date, country_code | matches: loser_id, winner_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( * ) from players
430
wta_1
How many players are there?
| players: player_id, first_name, last_name, hand, birth_date, country_code | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) from players
431
wta_1
Find the total number of matches.
| matches: match_num, winner_id, loser_id, year, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) from matches
432
wta_1
Count the number of matches.
| matches: match_num, winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) from matches
433
wta_1
List the first name and birth date of all players from the country with code USA.
| players: first_name, birth_date, country_code, player_id, last_name, hand | matches: match_num, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select first_name , birth_date from players where country_code = 'USA'
434
wta_1
What are the first names and birth dates of players from the USA?
| players: country_code, first_name, birth_date, player_id, last_name, hand | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select first_name , birth_date from players where country_code = 'USA'
435
wta_1
Find the average age of losers and winners of all matches.
| matches: winner_age, loser_age | players: player_id |
select avg ( loser_age ) , avg ( winner_age ) from matches
436
wta_1
What are the average ages of losers and winners across matches?
| matches: winner_age, loser_age | players: | rankings: | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select avg ( loser_age ) , avg ( winner_age ) from matches
437
wta_1
Find the average rank of winners in all matches.
| players: player_id | matches: winner_rank, winner_id, match_num | rankings: player_id, ranking |
select avg ( winner_rank ) from matches
438
wta_1
What is the average rank for winners in all matches?
| matches: winner_rank, winner_id | players: player_id | rankings: player_id |
select avg ( winner_rank ) from matches
439
wta_1
Find the highest rank of losers in all matches.
| matches: loser_rank | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id=players.player_id | matches.loser_id=players.player_id | rankings.player_id=players.player_id |
select min ( loser_rank ) from matches
440
wta_1
What is the best rank of losers across all matches?
| matches: loser_rank, loser_id | players: player_id | rankings: ranking, player_id |
select min ( loser_rank ) from matches
441
wta_1
find the number of distinct country codes of all players.
| players: country_code, player_id | matches: winner_id, loser_id | rankings: player_id |
select count ( distinct country_code ) from players
442
wta_1
How many distinct countries do players come from?
| players: country_code, player_id, first_name, last_name, hand, birth_date | matches: winner_id, loser_id, match_num, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( distinct country_code ) from players
443
wta_1
Find the number of distinct name of losers.
| matches: loser_name, loser_id | players: player_id | rankings: player_id |
select count ( distinct loser_name ) from matches
444
wta_1
How many different loser names are there?
| matches: loser_name | players: first_name, last_name, player_id | rankings: player_id |
select count ( distinct loser_name ) from matches
445
wta_1
Find the name of tourney that has more than 10 matches.
| players: player_id | matches: tourney_name, tourney_id, match_num | rankings: player_id | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select tourney_name from matches group by tourney_name having count ( * ) > 10
446
wta_1
What are the names of tournaments that have more than 10 matches?
| matches: tourney_name, match_num, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select tourney_name from matches group by tourney_name having count ( * ) > 10
447
wta_1
List the names of all winners who played in both 2013 and 2016.
| players: player_id, first_name, last_name | matches: winner_id, year | rankings: player_id |
select winner_name from matches where year = 2013 intersect select winner_name from matches where year = 2016
448
wta_1
What are the names of players who won in both 2013 and 2016?
| players: player_id, first_name, last_name, hand, birth_date, country_code | matches: year, winner_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select winner_name from matches where year = 2013 intersect select winner_name from matches where year = 2016
449
wta_1
List the number of all matches who played in years of 2013 or 2016.
| matches: year, match_num, tourney_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) from matches where year = 2013 or year = 2016
450
wta_1
How many matches were played in 2013 or 2016?
| matches: year, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( * ) from matches where year = 2013 or year = 2016
451
wta_1
What are the country code and first name of the players who won in both tourney WTA Championships and Australian Open?
| players: player_id, first_name, country_code | matches: winner_id, tourney_name | rankings: none | matches.winner_id = players.player_id |
select players.country_code , players.first_name from players join matches on players.player_id = matches.winner_id where matches.tourney_name = 'WTA Championships' intersect select players.country_code , players.first_name from players join matches on players.player_id = matches.winner_id where matches.tourney_name = 'Australian Open'
452
wta_1
What are the first names and country codes for players who won both the WTA Championships and the Australian Open?
| players: player_id, first_name, country_code, last_name, hand, birth_date | matches: winner_id, tourney_name, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select players.country_code , players.first_name from players join matches on players.player_id = matches.winner_id where matches.tourney_name = 'WTA Championships' intersect select players.country_code , players.first_name from players join matches on players.player_id = matches.winner_id where matches.tourney_name = 'Australian Open'
453
wta_1
Find the first name and country code of the oldest player.
| players: first_name, country_code, birth_date, player_id | matches: None | rankings: None |
select first_name , country_code from players order by birth_date asc limit 1
454
wta_1
What is the first name and country code of the oldest player?
| players: birth_date, first_name, country_code, player_id, last_name, hand | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select first_name , country_code from players order by birth_date asc limit 1
455
wta_1
List the first and last name of all players in the order of birth date.
| players: first_name, last_name, birth_date, player_id, hand, country_code | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select first_name , last_name from players order by birth_date asc
456
wta_1
What are the full names of all players, sorted by birth date?
| players: birth_date, first_name, last_name, player_id, hand, country_code | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id=players.player_id | matches.loser_id=players.player_id | rankings.player_id=players.player_id |
select first_name , last_name from players order by birth_date asc
457
wta_1
List the first and last name of all players who are left / L hand in the order of birth date.
| players: hand, first_name, last_name, birth_date, player_id, country_code | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours |
select first_name , last_name from players where hand = 'L' order by birth_date asc
458
wta_1
What are the full names of all left handed players, in order of birth date?
| players: hand, first_name, last_name, birth_date, player_id, country_code | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select first_name , last_name from players where hand = 'L' order by birth_date asc
459
wta_1
Find the first name and country code of the player who did the most number of tours.
| players: player_id, first_name, country_code | rankings: player_id, tours | matches: winner_id, loser_id |
select players.country_code , players.first_name from players join rankings on players.player_id = rankings.player_id order by rankings.tours desc limit 1
460
wta_1
What is the first name and country code of the player with the most tours?
| rankings: tours, player_id | players: first_name, country_code, player_id |
select players.country_code , players.first_name from players join rankings on players.player_id = rankings.player_id order by rankings.tours desc limit 1
461
wta_1
Find the year that has the most number of matches.
| matches: year, match_num | players: player_id | rankings: not relevant | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select year from matches group by year order by count ( * ) desc limit 1
462
wta_1
Which year had the most matches?
| matches: year, match_num, tourney_id, winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select year from matches group by year order by count ( * ) desc limit 1
463
wta_1
Find the name and rank points of the winner who won the most times.
| players: player_id, first_name, last_name | matches: winner_id, winner_name, winner_rank_points | rankings: player_id |
select winner_name , winner_rank_points from matches group by winner_name order by count ( * ) desc limit 1
464
wta_1
What is the name of the winner who has won the most matches, and how many rank points does this player have?
| players: player_id, first_name, last_name, hand, birth_date, country_code | matches: winner_id, winner_rank_points, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_seed, year | rankings: player_id, ranking_points, ranking_date, ranking, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select winner_name , winner_rank_points from matches group by winner_name order by count ( * ) desc limit 1
465
wta_1
Find the name of the winner who has the highest rank points and participated in the Australian Open tourney.
| players: player_id, first_name, last_name | matches: winner_id, winner_rank_points, tourney_name, winner_name | rankings: player_id, ranking_points | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select winner_name from matches where tourney_name = 'Australian Open' order by winner_rank_points desc limit 1
466
wta_1
What is the name of the winner with the most rank points who participated in the Australian Open tournament?
| players: player_id, first_name, last_name | matches: winner_id, winner_rank_points, tourney_name | rankings: player_id, ranking_points | matches.winner_id = players.player_id | rankings.player_id = players.player_id |
select winner_name from matches where tourney_name = 'Australian Open' order by winner_rank_points desc limit 1
467
wta_1
find the names of loser and winner who played in the match with greatest number of minutes.
| matches: minutes, winner_id, winner_name, loser_id, loser_name | players: player_id, first_name, last_name | rankings: player_id |
select winner_name , loser_name from matches order by minutes desc limit 1
468
wta_1
What are the names of the winner and loser who played in the longest match?
| matches: minutes, winner_id, loser_id | players: player_id, first_name, last_name | matches.winner_id = players.player_id | matches.loser_id = players.player_id |
select winner_name , loser_name from matches order by minutes desc limit 1
469
wta_1
Find the average ranking for each player and their first name.
| players: player_id, first_name | matches: winner_id, loser_id, winner_rank, loser_rank | rankings: player_id, ranking |
select avg ( ranking ) , players.first_name from players join rankings on players.player_id = rankings.player_id group by players.first_name
470
wta_1
What are the first names of all players, and their average rankings?
| players: first_name, player_id, last_name, hand, birth_date, country_code | rankings: player_id, ranking, ranking_date, ranking_points, tours | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year |
select avg ( ranking ) , players.first_name from players join rankings on players.player_id = rankings.player_id group by players.first_name
471
wta_1
Find the total ranking points for each player and their first name.
| players: player_id, first_name | matches: | rankings: player_id, ranking_points |
select sum ( ranking_points ) , players.first_name from players join rankings on players.player_id = rankings.player_id group by players.first_name
472
wta_1
What are the first names of all players, and their total ranking points?
| players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select sum ( ranking_points ) , players.first_name from players join rankings on players.player_id = rankings.player_id group by players.first_name
473
wta_1
find the number of players for each country.
| players: country_code, player_id, first_name, last_name, hand, birth_date | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( * ) , country_code from players group by country_code
474
wta_1
How many players are from each country?
| players: country_code, player_id, first_name, last_name, hand, birth_date | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) , country_code from players group by country_code
475
wta_1
find the code of the country where has the greatest number of players.
| players: country_code, player_id, first_name, last_name, hand, birth_date | matches: winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select country_code from players group by country_code order by count ( * ) desc limit 1
476
wta_1
What is the code of the country with the most players?
| players: country_code, player_id | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select country_code from players group by country_code order by count ( * ) desc limit 1
477
wta_1
Find the codes of countries that have more than 50 players.
| players: country_code, player_id | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours |
select country_code from players group by country_code having count ( * ) > 50
478
wta_1
What are the codes of countries with more than 50 players?
| players: country_code, player_id, first_name, last_name, hand, birth_date | matches: loser_id, loser_ioc, winner_id, winner_ioc, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, tours, ranking_points | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select country_code from players group by country_code having count ( * ) > 50
479
wta_1
Find the total number of tours for each ranking date.
| rankings: ranking_date, tours, player_id, ranking, ranking_points | players: player_id, first_name, last_name, hand, birth_date, country_code | matches: best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year |
select sum ( tours ) , ranking_date from rankings group by ranking_date
480
wta_1
How many total tours were there for each ranking date?
| rankings: ranking_date, tours, player_id, ranking_points, ranking | players: player_id, first_name, last_name, hand, birth_date, country_code | matches: tourney_id, winner_id, loser_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select sum ( tours ) , ranking_date from rankings group by ranking_date
481
wta_1
Find the number of matches happened in each year.
| matches: year, match_num, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( * ) , year from matches group by year
482
wta_1
How many matches were played in each year?
| matches: year, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_id, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed | players: player_id, first_name, last_name, hand, birth_date, country_code | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select count ( * ) , year from matches group by year
483
wta_1
Find the name and rank of the 3 youngest winners across all matches.
| players: first_name, last_name, player_id, birth_date, hand, country_code | matches: winner_id, winner_name, winner_age, winner_rank, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_entry, winner_hand, winner_ht, winner_ioc, winner_rank_points, winner_seed, year | rankings: player_id, ranking, ranking_date, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select distinct winner_name , winner_rank from matches order by winner_age asc limit 3
484
wta_1
What are the names and ranks of the three youngest winners across all matches?
| players: player_id, first_name, last_name, birth_date, hand, country_code | matches: winner_id, winner_age, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking, ranking_date, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select distinct winner_name , winner_rank from matches order by winner_age asc limit 3
485
wta_1
How many different winners both participated in the WTA Championships and were left handed?
| players: player_id, hand | matches: winner_id, tourney_name |
select count ( distinct winner_name ) from matches where tourney_name = 'WTA Championships' and winner_hand = 'L'
486
wta_1
Find the number of left handed winners who participated in the WTA Championships.
| players: hand, player_id, first_name, last_name, birth_date, country_code | matches: winner_id, winner_hand, tourney_name, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, winner_age, winner_entry, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( distinct winner_name ) from matches where tourney_name = 'WTA Championships' and winner_hand = 'L'
487
wta_1
Find the first name, country code and birth date of the winner who has the highest rank points in all matches.
| players: player_id, first_name, birth_date, country_code, last_name, hand | matches: winner_id, winner_rank_points, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_seed, year | rankings: player_id, ranking_points, ranking_date, ranking, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select players.first_name , players.country_code , players.birth_date from players join matches on players.player_id = matches.winner_id order by matches.winner_rank_points desc limit 1
488
wta_1
What is the first name, country code, and birth date of the player with the most winner rank points across all matches?
| players: player_id, first_name, country_code, birth_date, last_name, hand | matches: winner_id, winner_rank_points, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_id, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_seed, year | rankings: ranking_date, ranking, player_id, ranking_points, tours | matches.winner_id = players.player_id | matches.loser_id = players.player_id | rankings.player_id = players.player_id |
select players.first_name , players.country_code , players.birth_date from players join matches on players.player_id = matches.winner_id order by matches.winner_rank_points desc limit 1
489
wta_1
Find the number of players for each hand type.
| players: hand, player_id, first_name, last_name, birth_date, country_code | matches: loser_id, winner_id, best_of, draw_size, loser_age, loser_entry, loser_hand, loser_ht, loser_ioc, loser_name, loser_rank, loser_rank_points, loser_seed, match_num, minutes, round, score, surface, tourney_date, tourney_id, tourney_level, tourney_name, winner_age, winner_entry, winner_hand, winner_ht, winner_ioc, winner_name, winner_rank, winner_rank_points, winner_seed, year | rankings: player_id, ranking_date, ranking, ranking_points, tours |
select count ( * ) , hand from players group by hand
490
wta_1
How many players are there for each hand type?
| players: hand, player_id | matches: loser_hand, winner_hand | rankings: player_id |
select count ( * ) , hand from players group by hand
491
battle_death
How many ships ended up being 'Captured'?
| ship: disposition_of_ship, id, name, ship_type, lost_in_battle, tonnage, location | battle: id, name, date, bulgarian_commander, latin_commander, result | death: id, note, caused_by_ship_id, killed, injured | ship.lost_in_battle = battle.id | death.caused_by_ship_id = ship.id |
select count ( * ) from ship where disposition_of_ship = 'Captured'
492
battle_death
List the name and tonnage ordered by in descending alphaetical order for the names.
| ship: name, tonnage, id, lost_in_battle, ship_type, location, disposition_of_ship | battle: id, name, date, bulgarian_commander, latin_commander, result | death: caused_by_ship_id, id, note, killed, injured | ship.lost_in_battle = battle.id | death.caused_by_ship_id = ship.id |
select name , tonnage from ship order by name desc
493
battle_death
List the name, date and result of each battle.
| battle: name, date, result, id, bulgarian_commander, latin_commander | ship: id, lost_in_battle, name, tonnage, ship_type, location, disposition_of_ship | death: id, caused_by_ship_id, note, killed, injured |
select name , date from battle
494
battle_death
What is maximum and minimum death toll caused each time?
| battle: id | ship: lost_in_battle, id | death: caused_by_ship_id, killed |
select max ( killed ) , min ( killed ) from death
495
battle_death
What is the average number of injuries caused each time?
| death: injured, caused_by_ship_id, id, note, killed | ship: lost_in_battle, id, name, tonnage, ship_type, location, disposition_of_ship | battle: id, name, date, bulgarian_commander, latin_commander, result |
select avg ( injured ) from death
496
battle_death
What are the death and injury situations caused by the ship with tonnage 't'?
| ship: tonnage, id, lost_in_battle, name, ship_type, location, disposition_of_ship | death: caused_by_ship_id, killed, injured, id, note | battle: id, result | ship.lost_in_battle = battle.id | death.caused_by_ship_id = ship.id |
select death.killed , death.injured from death join ship on death.caused_by_ship_id = ship.id where ship.tonnage = 't'
497
battle_death
What are the name and results of the battles when the bulgarian commander is not 'Boril'
| battle: bulgarian_commander, name, result, id, date, latin_commander | ship: lost_in_battle, id, name, tonnage, ship_type, location, disposition_of_ship | death: caused_by_ship_id, id, note, killed, injured | ship.lost_in_battle = battle.id | death.caused_by_ship_id = ship.id |
select name , result from battle where bulgarian_commander != 'Boril'
498
battle_death
What are the different ids and names of the battles that lost any 'Brig' type shipes?
| battle: id, name | ship: ship_type, id, lost_in_battle | death: |
select distinct battle.id , battle.name from battle join ship on battle.id = ship.lost_in_battle where ship.ship_type = 'Brig'
499
battle_death
What are the ids and names of the battles that led to more than 10 people killed in total.
| battle: id, name | death: caused_by_ship_id, killed | ship: lost_in_battle, id |
select battle.id , battle.name from battle join ship on battle.id = ship.lost_in_battle join death on ship.id = death.caused_by_ship_id group by battle.id having sum ( death.killed ) > 10