db_id stringclasses 68 values | question stringlengths 24 325 | evidence stringlengths 0 580 | SQL stringlengths 23 728 |
|---|---|---|---|
legislator | How many current legislators were born after the year 1960? | born after the year 1960 refers to birthday_bio > '1960-01-01' | SELECT COUNT(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01' |
legislator | Among all the current female legislators, how many of them have not been registered in Federal Election Commission data? | have not been registered refers to fec_id IS NULL; female refers to gender_bio = 'F' | SELECT COUNT(*) FROM current WHERE (fec_id IS NULL OR fec_id = '') AND gender_bio = 'F' |
legislator | What is the google entity ID of current legislator Sherrod Brown? | Sherrod Brown is an official_full_name | SELECT google_entity_id_id FROM current WHERE official_full_name = 'Sherrod Brown' |
legislator | Which current legislator is older, Sherrod Brown or Maria Cantwell? | older refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name | SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1 |
legislator | How many males were members of the current legislators? | male refers to gender_bio = 'M' | SELECT COUNT(*) FROM current WHERE gender_bio = 'M' |
legislator | How many females were members of the past legislators? | female refers to gender_bio = 'F' | SELECT COUNT(*) FROM historical WHERE gender_bio = 'F' |
legislator | How many male legislators are Roman Catholic? | male refers to gender_bio = 'M'; Roman Catholic is a religion_bio | SELECT COUNT(*) FROM current WHERE religion_bio = 'Roman Catholic' AND gender_bio = 'M' |
legislator | Calculate the percentage of the total number of current female legislators and past female legislators. State which one has the highest value. | female refers to gender_bio = 'F'; calculation = MULTIPLY(DIVIDE(COUNT(current.gender_bio = 'F' THEN current.bioguide_id)), (COUNT(historical.gender_bio = 'F' then historical.bioguide_id)), 1.0); the highest value refers to MAX(calculation) | SELECT CAST(COUNT(CASE WHEN current.gender_bio = 'F' THEN current.bioguide_id ELSE NULL END) AS REAL) * 100 / ( SELECT COUNT(CASE WHEN historical.gender_bio = 'F' THEN historical.bioguide_id ELSE NULL END) FROM historical ) FROM current |
legislator | What is the ratio of males and females among historical legislators? | male refers to gender_bio = 'M'; female refers to gender_bio = 'F'; calculation = DIVIDE(COUNT(gender_bio = 'M' THEN bioguide_id), COUNT(gender_bio = 'F' THEN bioguide_id)) | SELECT CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical |
legislator | List the official full names and genders of legislators who have Collins as their last name. | genders refers to gender_bio; Collins is a last_name | SELECT official_full_name, gender_bio FROM current WHERE last_name = 'Collins' |
legislator | What is the birthday of Amy Klobuchar? | birthday refers to birthday_bio; Amy Klobuchar refers to full name; full name refers to first_name, last_name | SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar' |
legislator | How many legislators have not been registered in Federal Election Commission data? | have not been registered in Federal Election Commission data refers to fec_id is null OR fec_id = '' | SELECT COUNT(*) FROM current WHERE fec_id IS NULL OR fec_id = '' |
legislator | State the number of female legislators in the list. | female refers to gender_bio = 'F' | SELECT COUNT(*) FROM current WHERE gender_bio = 'F' |
legislator | Give the full name of legislators who have accounts on OpenSecrets.org. | full name refers to first_name, last_name; have accounts on OpenSecrets.org refers to opensecrets_id IS NOT NULL AND opensecrets_id <> '' | SELECT COUNT(*) FROM current WHERE opensecrets_id IS NOT NULL AND opensecrets_id <> '' |
legislator | What is the middle name of the legislator whose birthday was on 8/24/1956? | birthday was on 8/24/1956 refers to birthday_bio = '1956-08-24' | SELECT middle_name FROM current WHERE birthday_bio = '1956-08-24' |
legislator | How many of the legislators are male? | male refers to gender_bio = 'M'; | SELECT COUNT(*) FROM current WHERE gender_bio = 'M' |
legislator | What is the total number of legislators with "John" as their first name? | SELECT COUNT(*) FROM current WHERE first_name = 'John' | |
legislator | What is the google entity ID of Benjamin Hawkins? | SELECT google_entity_id_id FROM historical WHERE first_name = 'Benjamin' AND last_name = 'Hawkins' | |
legislator | What is the name of the legislator with the ID of W000059? | name of the legislator = first_name, last_name; ID of W000059 refers to bioguide_id = 'W000059'; | SELECT first_name, last_name FROM historical WHERE bioguide_id = 'W000059' |
legislator | Does Thomas Carnes have an account on ballotpedia.org? | if first_name = 'Thomas' and last_name = 'Carnes' AND ballotpedia_id is null then Thomas Carnes doesn't have an account on ballotpedia.org; if first_name = 'Thomas' and last_name = 'Carnes' AND ballotpedia_id is NOT null then Thomas Carnes have an account on ballotpedia.org; | SELECT CASE WHEN ballotpedia_id IS NULL THEN 'doesn''t have' ELSE 'have' END AS HaveorNot FROM historical WHERE first_name = 'Thomas' AND last_name = 'Carnes' |
legislator | How many legislators were born in 1736? | born in 1736 refers to birthday_bio like '1736%'; | SELECT COUNT(bioguide_id) FROM historical WHERE birthday_bio LIKE '1736%' |
legislator | Which legislators are woman? | woman refers to gender_bio = 'F'; | SELECT first_name, last_name FROM historical WHERE gender_bio = 'F' |
legislator | What is the ratio between male and female legislators? | ratio = DIVIDE(SUM(gender_bio = 'M'), SUM(gender_bio = 'F')); male refers to gender_bio = 'M'; female refers to gender_bio = 'F' | SELECT CAST(SUM(CASE WHEN gender_bio = 'M' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) FROM historical |
legislator | Calculate the percentage of famous_legislatorss. | percentage = MULTIPLY(DIVIDE(SUM(wikipedia_id is not null), (bioguide_id)), 100.0); famous legislators refers to wikipedia_id is not null; | SELECT CAST(SUM(CASE WHEN wikipedia_id IS NOT NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(bioguide_id) FROM historical |
legislator | How many Catholic legislators do not have an account on ballotpedia.org? | Catholic refers to religion_bio = 'Catholic'; do not have an account on ballotpedia.org refers to ballotpedia_id is null; | SELECT COUNT(bioguide_id) FROM historical WHERE religion_bio = 'Catholic' AND ballotpedia_id IS NULL |
legislator | What is the full name of the oldest legislator? | full name = first_name, last_name; oldest legislator refers to MIN(birthday_bio); | SELECT first_name, last_name FROM historical ORDER BY birthday_bio LIMIT 1 |
legislator | Please list the official full names of all the current legislators who have served in the U.S. House. | have served in the U.S. House refers to house_history_id is not null; | SELECT official_full_name FROM current WHERE house_history_id IS NOT NULL |
legislator | How many current legislators have both accounts on both VoteView.com and maplight.org? | have both accounts on both VoteView.com and maplight.org refers to icpsr_id is not null AND maplight_id is not null; | SELECT COUNT(*) FROM current WHERE icpsr_id IS NOT NULL AND maplight_id IS NOT NULL |
legislator | Among all the current female legislators, how many of them have attended in Senate roll call votes? | female refers to gender_bio = 'F'; have attended in Senate roll call votes refers to lis_id is not null; | SELECT COUNT(lis_id) FROM current WHERE gender_bio = 'F' AND lis_id IS NOT NULL |
legislator | What is the religion of current legislator Sherrod Brown? | religion refers to religion_bio; | SELECT religion_bio FROM current WHERE official_full_name = 'Sherrod Brown' |
legislator | What is the religion with the most occurrrence of the current legislators? | religion with the most occurrrence of the current legislators refers to MAX(count(religion_bio)); | SELECT religion_bio FROM current GROUP BY religion_bio ORDER BY COUNT(religion_bio) DESC LIMIT 1 |
legislator | How many of the legislators are female? | female refers to gender_bio = 'F'; | SELECT COUNT(gender_bio) FROM current WHERE gender_bio = 'F' |
olympics | Please list the names of all the Olympic games that John Aalberg has taken part in. | name of the Olympic games refers to games_name; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' |
olympics | What was the name of the Olympic game that John Aalberg took part in when he was 31? | when he was 31 refers to age = 31; name of the Olympic games refers to games_name; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T2.age = 31 |
olympics | When John Aalberg took part in the 1994 Winter Olympic Game, how old was he? | how old was he refers to age; 1994 Winter refers to games_name = '1994 Winter'; | SELECT T2.age FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' AND T1.games_name = '1994 Winter' |
olympics | How many Olympic competitors are from Finland? | competitors refer to person_id; from Finland refers to region_name = 'Finland'; | SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Finland' |
olympics | Please list the names of all the Olympic competitors from Finland. | names of competitors refer to full_name; from Finland refers to region_name = 'Finland'; | SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' |
olympics | The Olympic competitor John Aalberg is from which region? | from which region refers to region_name; | SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'John Aalberg' |
olympics | What is the NOC code of the region where the tallest male Olympic competitor is from? | NOC code of the region refers to noc; male refers to gender = 'M'; the tallest refers to MAX(height); | SELECT T1.noc FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.gender = 'M' ORDER BY T3.height DESC LIMIT 1 |
olympics | Among all the Olympic competitors from Finland, how many of them are female? | competitors from Finland refer to id where region_name = 'Finland'; female refers to gender = 'F'; | SELECT COUNT(T3.id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'F' |
olympics | In which city was the 1992 Summer Olympic Games held? | In which city refers to city_name; 1992 Summer Olympic Games refer to games_name = '1992 Summer'; | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1992 Summer' |
olympics | Please list the names of the Olympic games that were held in London. | held in London refers to city_name = 'London'; | SELECT T3.games_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' |
olympics | In which year did London hold its earliest Olympic game? | In which year refers to games_year; London refers to city_name = 'London'; earliest Olympic game refers to MIN(games_year); | SELECT T3.games_year FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' ORDER BY T3.games_year LIMIT 1 |
olympics | For how many times has London held the Olympic games? | London refers to city_name = 'London'; how many times refer to COUNT(games_id); | SELECT COUNT(T1.games_id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'London' |
olympics | What is the average height of the male Olympic competitors from Finland? | DIVIDE(SUM(height), COUNT(id)) where region_name = 'Finland' and gender = 'M'; | SELECT AVG(T3.height) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Finland' AND T3.gender = 'M' |
olympics | Among the competitors of the 1994 Winter Olympic Game, what is the percentage of those from Finland? | DIVIDE(COUNT(id where region_name = 'Finland'), COUNT(id)) as percentage where games_name = '1994 Winter'; | SELECT CAST(COUNT(CASE WHEN T5.region_name = 'Finland' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id INNER JOIN person_region AS T4 ON T3.id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.games_name = '1994 Winter' |
olympics | Which sport does the event "Shooting Women's Trap" belong to? | sport refers to sport_name; event "Shooting Women's Trap" refers to event_name = 'Shooting Women''s Trap'; | SELECT T1.sport_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T2.event_name LIKE 'Shooting Women%s Trap' |
olympics | Which city was the host of 1936 Winter Olympic Games? | Which city refers to city_name; 1936 Winter Olympic refers to games_name = '1936 Winter'; | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name = '1936 Winter' |
olympics | How many Olympic Games has London hosted? | London refers to city_name = 'London'; | SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'London' |
olympics | Tell the number of swimming related events. | swimming refers to sport_name = 'Swimming'; | SELECT COUNT(T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Swimming' |
olympics | For Peter Kohnke, show the name of his/her region. | name of his/her region refers to region_name; | SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Peter Kohnke' |
olympics | Which game has Jessica Carolina Aguilera Aguilera participated in? Give the id of the game. | id of the game refers to games_id; | SELECT T2.games_id FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Jessica Carolina Aguilera Aguilera' |
olympics | Show the name of the sport with the most events. | name of the sport with the most events refers to sport_name where MAX(COUNT(id)); | SELECT T1.sport_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id GROUP BY T1.sport_name ORDER BY COUNT(T2.event_name) DESC LIMIT 1 |
olympics | Give the name of the tallest athlete from Sweden. | the tallest athlete refers to id where MAX(height); from Sweden refers to region_name = 'Sweden'; name refers to full_name; | SELECT T3.full_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Sweden' ORDER BY T3.height DESC LIMIT 1 |
olympics | How many athletes in the database are from Guatemala? | from Guatemala refers to region_name = 'Guatemala'; | SELECT COUNT(T1.person_id) FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id WHERE T2.region_name = 'Guatemala' |
olympics | Show the name of the competitor id 90991. | name of the competitor refers to full_name; | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.id = 90991 |
olympics | How many competitor ids does Martina Kohlov have? | SELECT COUNT(T2.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Martina Kohlov' | |
olympics | Calculate the bmi of the competitor id 147420. | DIVIDE(weight), MULTIPLY(height, height) where id = 147420; | SELECT CAST(T1.weight AS REAL) / (T1.height * T1.height) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.id = 147420 |
olympics | What is the percentage of male athletes from Estonia? | DIVIDE(COUNT(id where gender = 'M'), COUNT(id)) as percentage where region_name = 'Estonia'; | SELECT CAST(COUNT(CASE WHEN T3.gender = 'M' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Estonia' |
olympics | Who is the youngest person who participated in the Olympics? | Who is the youngest person refers to full_name where MIN(age); | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T2.age LIMIT 1 |
olympics | How many 24 years old competitors competed in Men's Basketball? | 24 years old competitors refer to id where age = 24; Men's Basketball refers to event_name = 'Basketball Men''s Basketball'; | SELECT COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN event AS T3 ON T1.event_id = T3.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball' AND T2.age = 24 |
olympics | What are the names of the events under Art Competitions? | Art Competitions refer to sport_name = 'Art Competitions'; names of events refers to event_name; | SELECT T2.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Art Competitions' |
olympics | How many gold medals does Henk Jan Zwolle have? | gold medals refer to medal_name = 'Gold'; | SELECT COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Henk Jan Zwolle' AND T4.medal_name = 'Gold' |
olympics | What is the name of the event where competitors received the most gold medals? | received the most gold medals refers to MAX(COUNT(medal_name = 'Gold')); | SELECT T2.event_name FROM competitor_event AS T1 INNER JOIN event AS T2 ON T1.event_id = T2.id INNER JOIN medal AS T3 ON T1.medal_id = T3.id WHERE T3.medal_name = 'Gold' GROUP BY T2.id ORDER BY COUNT(T1.event_id) DESC LIMIT 1 |
olympics | How many athletes are from Australia? | from Australia refer region_name = 'Australia'; | SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id WHERE T1.region_name = 'Australia' |
olympics | Which cities hosted at least 3 Olympic games? | cities refer to city_name; hosted at least 3 Olympic games refers to COUNT(games_id) > = 3; | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id GROUP BY T2.id HAVING COUNT(T1.games_id) >= 3 |
olympics | How many Summer games were held in Stockholm? | Summer games refer to id where season = 'Summer'; in Stockholm refers to city_name = 'Stockholm'; | SELECT COUNT(T3.id) FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T2.city_name = 'Stockholm' AND T3.season = 'Summer' |
olympics | Which region do most of the athletes are from? | region refers to region_name; most of the athletes refer to MAX(COUNT(person_id)); | SELECT T2.region_name FROM person_region AS T1 INNER JOIN noc_region AS T2 ON T1.region_id = T2.id GROUP BY T2.region_name ORDER BY COUNT(T1.person_id) DESC LIMIT 1 |
olympics | Where was the first Olympic game held? | Where it was held refers to city_name; the first Olympic game refers to id where MIN(games_year); | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id ORDER BY T3.games_year LIMIT 1 |
olympics | What is the name of the game in which the oldest Olympian has ever participated? | the oldest Olympian refers to id where MAX(age); name of the game refers to games_name; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id ORDER BY T2.age LIMIT 1 |
olympics | How many athletes competed in the 1992 Summer Olympics? | 1992 Summer Olympics refer to games_name = '1928 Summer'; | SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1928 Summer' |
olympics | How many Olympic events did Michael Phelps II join in total? Find the percentage of the events where he won a gold medal. | DIVIDE(COUNT(event_id where medal_name = 'Gold'), COUNT(event_id)) as percentage where full_name = 'Michael Fred Phelps, II'; | SELECT COUNT(T3.event_id) , CAST(COUNT(CASE WHEN T4.id = '1' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T4.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Michael Fred Phelps, II' |
olympics | What age of the competitors is the most numerous? | age is the most numerous refers to age where MAX(COUNT(person_id)); | SELECT age FROM games_competitor GROUP BY age ORDER BY COUNT(person_id) DESC LIMIT 1 |
olympics | In which cities beginning with the letter M have the Olympic Games been held? | cities beginning with the letter M refer to city_name LIKE 'M%'; | SELECT city_name FROM city WHERE city_name LIKE 'M%' |
olympics | In which cities were the 1976 winter and summer games held? | cities refer to city_name; 1976 winter and summer games refer to games_name IN ('1976 Winter', '1976 Summer'); | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id INNER JOIN games AS T3 ON T1.games_id = T3.id WHERE T3.games_name IN ('1976 Summer', '1976 Winter') |
olympics | What was the medal that Coleen Dufresne got? | What medal refers to medal_name; | SELECT T4.medal_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T1.full_name = 'Coleen Dufresne (-Stewner)' |
olympics | What is the name of the competitor who has won the most medals? | name of the competitor refers to full_name; won the most medals refer to MAX(COUNT(medal_id)); | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN medal AS T4 ON T3.medal_id = T4.id WHERE T4.id != 4 GROUP BY T1.full_name ORDER BY COUNT(T4.id) DESC LIMIT 1 |
olympics | Where is competitor Estelle Nze Minko from? | Where competitor is from refers to region_name; | SELECT T1.region_name FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Estelle Nze Minko' |
olympics | What is the name of all the sports Chin Eei Hui has competed in? | name of the sport refers to sport_name; | SELECT DISTINCT T1.sport_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id INNER JOIN competitor_event AS T3 ON T2.id = T3.event_id INNER JOIN games_competitor AS T4 ON T3.competitor_id = T4.id INNER JOIN person AS T5 ON T4.person_id = T5.id WHERE T5.full_name = 'Chin Eei Hui' |
olympics | What is the name of the oldest person who participated in the Olympic Games? | the oldest person refers to person_id where MAX(age); name refers to full_name; | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T2.age DESC LIMIT 1 |
olympics | In which Olympic Games have the largest number of women participation? | the largest number of women participation refers to MAX(COUNT(gender = 'F')); In which Olympic Games refer to games_year; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.gender = 'F' GROUP BY T1.games_name ORDER BY COUNT(T2.person_id) DESC LIMIT 1 |
olympics | How many males from Belgium have participated in an Olympic Games? | males refer to gender = 'M'; Belgium refers to region_name = 'Belgium'; | SELECT COUNT(T2.person_id) FROM noc_region AS T1 INNER JOIN person_region AS T2 ON T1.id = T2.region_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.region_name = 'Belgium' AND T3.gender = 'M' |
olympics | How many persons participated in the Sapporo Olympics? | the Sapporo Olympics refer to games_id where city_name = 'Sapporo'; | SELECT COUNT(T1.person_id) FROM games_competitor AS T1 INNER JOIN games_city AS T2 ON T1.games_id = T2.games_id INNER JOIN city AS T3 ON T2.city_id = T3.id WHERE T3.city_name = 'Sapporo' |
olympics | In which Olympic Games has Morten Aleksander Djupvik participated? | In which Olympic Games refer to games_year; | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T3.full_name = 'Morten Aleksander Djupvik' |
olympics | How many persons in total have participated in 12 meter Mixed Sailing competitions? | 12 meter Mixed Sailing competitions refer to event_name = 'Sailing Mixed 12 metres'; | SELECT COUNT(T1.competitor_id) FROM competitor_event AS T1 INNER JOIN event AS T2 ON T1.event_id = T2.id INNER JOIN sport AS T3 ON T2.sport_id = T3.id WHERE T2.event_name = 'Sailing Mixed 12 metres' |
olympics | How many different events are there of Modern Pentathlon? | Modern Pentathlon refers to sport_name = 'Modern Pentathlon'; | SELECT COUNT(DISTINCT T2.event_name) FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Modern Pentathlon' |
olympics | Calculate the percentage of women who have participated in Equestrianism Mixed Three-Day Event, Individual. | DIVIDE(COUNT(person_id where gender = 'F), COUNT(person_id)) as percentage where event_name = 'Equestrianism Mixed Three-Day Event, Individual'; | SELECT CAST(COUNT(CASE WHEN T1.gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN competitor_event AS T3 ON T2.id = T3.competitor_id INNER JOIN event AS T4 ON T3.event_id = T4.id WHERE T4.event_name = 'Equestrianism Mixed Three-Day Event, Individual' |
olympics | Calculate the average age of the persons who participated in the 1992 Summer Games. | DIVIDE(SUM(age), COUNT(person_id)) where games_name = '1992 Summer'; | SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '1992 Summer' |
olympics | List out years that only have summer games. | years refer to games_year; only have summer games refer to games_year where COUNT(games_name) = 1 and season = 'Summer'; | SELECT games_year FROM games WHERE season != 'Winter' GROUP BY games_year HAVING COUNT(season) = 1 |
olympics | How many Olympics games were held during the 90s? | games refer to id; during the 90s refers to games_year BETWEEN 1990 AND 1999; | SELECT COUNT(games_year) FROM games WHERE games_year BETWEEN '1990' AND '1999' |
olympics | How many athletes participated in the 2014 Winter Olympics? | athletes refer to person_id; 2014 Winter Olympics refer to games_name = '2014 Winter'; | SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '2014 Winter' |
olympics | How many athletes from region 151 have won a medal? | athletes refer to person_id; region 151 refers to region_id = 151; won a medal refers to medal_id <> 4; | SELECT COUNT(T3.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id INNER JOIN person_region AS T3 ON T2.person_id = T3.person_id WHERE T3.region_id = 151 AND T1.medal_id != 4 |
olympics | How many athlete from China participate in the 2016 Summer Olympics? | athletes from China refer to person_id where region_name = 'China'; the 2016 Summer Olympics refer to games_name = '2016 Summer'; | SELECT COUNT(T3.id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id INNER JOIN person_region AS T4 ON T3.id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.games_name = '2016 Summer' AND T5.region_name = 'China' |
olympics | How many gold medals were given to the winners in the Ice Hockey Men's Ice Hockey event? | gold medals given to the winners refer to competitor_id where medal_name = 'Gold'; Ice Hockey Men's Ice Hockey refers to event_name = 'Ice Hockey Men''s Ice Hockey'; | SELECT COUNT(T2.competitor_id) FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id WHERE T1.event_name LIKE 'Ice Hockey Men%s Ice Hockey' AND T2.medal_id = 1 |
olympics | Which region has the highest medal number? | region refers to region_name; the highest medal number refers to MAX(COUNT(medal_id <> 4)); | SELECT T5.region_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T1.id != 4 GROUP BY T5.region_name ORDER BY COUNT(T2.competitor_id) DESC LIMIT 1 |
olympics | List out all the gold medalist winners in cycling sport. | gold medalist winners refer to full_name where medal_name = 'Gold'; cycling sport refers to sport_name = 'Cycling'; | SELECT DISTINCT T5.full_name FROM event AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.event_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN sport AS T4 ON T1.sport_id = T4.id INNER JOIN person AS T5 ON T3.person_id = T5.id WHERE T4.sport_name = 'Cycling' AND T2.medal_id = 1 |
olympics | List out all the medals won by Lee Chong Wei. | medals refer to medal_id where medal_id <> 4; | SELECT DISTINCT T1.medal_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person AS T4 ON T3.person_id = T4.id WHERE T4.full_name = 'Lee Chong Wei' AND T2.medal_id <> 4 |
olympics | What is the percentage of female athletes below 20s who participated in the 2002 Winter Olympic? | DIVIDE(COUNT(person_id where gender = 'F' and age < 20), COUNT(person_id)) as percentage where games_name = '2002 Winter'; | SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2002 Winter' AND T2.age < 20 |
olympics | What is the ratio male to female athletes in the 2012 Summer Olympic? | DIVIDE(COUNT(gender = 'M'), COUNT(gender = 'F')) where games_name = '2012 Summer'; | SELECT CAST(COUNT(CASE WHEN T3.gender = 'M' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T3.gender = 'F' THEN 1 ELSE NULL END) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person AS T3 ON T2.person_id = T3.id WHERE T1.games_name = '2012 Summer' |
olympics | How many athletes from Malaysia have won a medal? | Malaysia refers to region_name = 'Malaysia'; athletes won a medal refer to competitor_id where medal_id <> 4; | SELECT COUNT(T3.person_id) FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id INNER JOIN games_competitor AS T3 ON T2.competitor_id = T3.id INNER JOIN person_region AS T4 ON T3.person_id = T4.person_id INNER JOIN noc_region AS T5 ON T4.region_id = T5.id WHERE T5.region_name = 'Malaysia' AND T1.id != 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.