Chinastark/bird_dataset huggingface dataset:
Database: olympics
Note: female athletes refer to id where gender = 'F'; from the Philippines region_name = 'Philippines';
Question: How many female athletes are from the Philippines?
SQL: SELECT count(person_region.person_id) FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Philippines' AND person.gender = 'F'
Database: olympics
Note: region refers to region_name;
Question: Which region is Yao Ming from?
SQL: SELECT noc_region.region_name FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE person.full_name = 'Yao Ming'
Database: olympics
Note: At what age join the Olympics refers to MIN(age);
Question: At what age did Michael Fred Phelps, II join the Olympics?
SQL: SELECT games_competitor.age FROM person INNER JOIN games_competitor ON person.id = games_competitor.person_id WHERE person.full_name = 'Michael Fred Phelps, II' ORDER BY games_competitor.age LIMIT 1
Database: olympics
Question: How many athletes are there in the region where Clara Hughes is from?
SQL: SELECT count(person_id) FROM person_region WHERE region_id = ( SELECT person_region.region_id FROM person_region INNER JOIN person ON person_region.person_id = person.id WHERE person.full_name = 'Clara Hughes' )
Database: olympics
Note: Men's 200 Metres Freestyle events refer to event_name = 'Swimming Men''s 200 metres Freestyle'; events compete in refers to event_id;
Question: How many Men's 200 Metres Freestyle events did Ian James Thorpe compete in?
SQL: SELECT count(person.id) FROM person INNER JOIN games_competitor ON person.id = games_competitor.person_id INNER JOIN competitor_event ON games_competitor.id = competitor_event.competitor_id INNER JOIN event ON competitor_event.event_id = event.id WHERE person.full_name = 'Ian James Thorpe' AND event.event_name LIKE 'Swimming Men%s 200 metres Freestyle'
Database: olympics
Note: Gymnastics Women's Individual All-Around refers to event_name = 'Gymnastics Women''s Individual All-Around'; declared as champion refers to medal_name = 'Gold' or medal_id = 1;
Question: How many times was Larysa Semenivna Latynina (Diriy-) declared as champion in Gymnastics Women's Individual All-Around?
SQL: SELECT count(event.id) FROM event INNER JOIN competitor_event ON event.id = competitor_event.event_id INNER JOIN games_competitor ON competitor_event.competitor_id = games_competitor.id INNER JOIN person ON games_competitor.person_id = person.id WHERE person.full_name = 'Larysa Semenivna Latynina (Diriy-)' AND event.event_name LIKE 'Gymnastics Women%s Individual All-Around' AND competitor_event.medal_id = 1
Database: olympics
Note: name of the cities refers to city_name;
Question: What are the names of the cities where Carl Lewis Borack competed?
SQL: SELECT city.city_name FROM person INNER JOIN games_competitor ON person.id = games_competitor.person_id INNER JOIN games_city ON games_competitor.games_id = games_city.games_id INNER JOIN city ON games_city.city_id = city.id WHERE person.full_name = 'Carl Lewis Borack'
Database: olympics
Note: London refers to city_name = 'London';
Question: How many Olympic games were held in London?
SQL: SELECT count(games_city.games_id) FROM games_city INNER JOIN city ON games_city.city_id = city.id WHERE city.city_name = 'London'
Database: olympics
Note: city refers to city_name; 1992 Summer Olympic refers to games_name = '1992 Summer';
Question: Which city was the 1992 Summer Olympic held?
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE games.games_name = '1992 Summer'
Database: olympics
Note: over the age of 59 refers to age > 59; the 2016 Summer Olympics refer to games_name = '2016 Summer';
Question: How many athletes over the age of 59 competed in the 2016 Summer Olympics?
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.games_name = '2016 Summer' AND games_competitor.age > 59
Database: olympics
Note: Los Angeles refers to city_name = 'Lost Angeles'; the Olympic game refers to games_name; the most number of competitors refers to MAX(COUNT(games_name));
Question: Among the Olympic games held in Los Angeles, what is the name of the Olympic game that has the most number of competitors?
SQL: SELECT games.games_name FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN games_city ON games_competitor.games_id = games_city.games_id INNER JOIN city ON games_city.city_id = city.id WHERE city.city_name = 'Los Angeles' GROUP BY games.id ORDER BY count(games_competitor.person_id) DESC LIMIT 1
Database: olympics
Note: 10-year old athletes refer to competitor_id where age = 10; Gymnastics Men's Parallel Bars, Teams refer to event_name = 'Gymnastics Men''s Parallel Bars, Teams';
Question: How many 10-year old athletes participated in the Gymnastics Men's Parallel Bars, Teams event?
SQL: SELECT count(games_competitor.person_id) FROM competitor_event INNER JOIN games_competitor ON competitor_event.competitor_id = games_competitor.id INNER JOIN event ON competitor_event.event_id = event.id WHERE event.event_name LIKE 'Gymnastics Men%s Parallel Bars, Teams' AND games_competitor.age = 10
Database: olympics
Note: AVG(age) where games_name = '2016 Summer' and region_name = 'USA';
Question: What is the average age of the athletes from the United States of America who competed in the 2016 Summer Olympics?
SQL: SELECT avg(games_competitor.age) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person_region ON games_competitor.person_id = person_region.person_id INNER JOIN noc_region ON person_region.region_id = noc_region.id WHERE games.games_name = '2016 Summer' AND noc_region.region_name = 'USA'
Database: olympics
Note: region refers to region_name; noc code "COL" refers to noc = 'COL';
Question: Which region does the NOC code "COL" stand for?
SQL: SELECT region_name FROM noc_region WHERE noc = 'COL'
Database: olympics
Note: name of sport refers to sport_name;
Question: State the name of sport id 19.
SQL: SELECT sport_name FROM sport WHERE id = 19
Database: olympics
Note: "Shooting Mixed Skeet" refers to event_name = 'Shooting Mixed Skeet';
Question: Give the id of the event "Shooting Mixed Skeet".
SQL: SELECT id FROM event WHERE event_name = 'Shooting Mixed Skeet'
Database: olympics
Note: hockey's sport refers to sport_name = 'hockey';
Question: Provide hockey's sport id.
SQL: SELECT id FROM sport WHERE sport_name = 'Hockey'
Database: olympics
Question: Tell the weight of Dagfinn Sverre Aarskog.
SQL: SELECT weight FROM person WHERE full_name = 'Dagfinn Sverre Aarskog'
Database: olympics
Note: Rio de Janeiro refers to city_name = 'Rio de Janeiro';
Question: What is the id of Rio de Janeiro?
SQL: SELECT id FROM city WHERE city_name = 'Rio de Janeiro'
Database: olympics
Note: won the gold medal refers to medal_name = 'Gold'; event "Rowing Women's Coxed Eights" refers to event_name = 'Rowing Women''s Coxed Eights';
Question: How many people have won the gold medal of the event "Rowing Women's Coxed Eights"?
SQL: SELECT count(competitor_event.competitor_id) FROM competitor_event INNER JOIN event ON competitor_event.event_id = event.id INNER JOIN medal ON competitor_event.medal_id = medal.id WHERE event.event_name LIKE 'Rowing Women%s Coxed Eights' AND medal.medal_name = 'Gold'
Database: olympics
Note: kinds of events refer to event_name; sport of cycling refers to sport_name = 'Cycling';
Question: How many kinds of events belong to the sport of cycling?
SQL: SELECT count(event.event_name) FROM sport INNER JOIN event ON sport.id = event.sport_id WHERE sport.sport_name = 'Cycling'
Database: olympics
Question: What is Vijay Singh Chauhan's region name?
SQL: SELECT noc_region.region_name FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE person.full_name = 'Vijay Singh Chauhan'
Database: olympics
Note: Roma refers to city_name = 'Roma'; When host refers to games_year;
Question: When did Roma host the Olympic Games?
SQL: SELECT games.games_year FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE city.city_name = 'Roma'
Database: olympics
Note: 20 years old athletes refer to person_id where age = 20; 1984 Summer Olympic games refer to games_name = '1984 Summer';
Question: How many 20 years old athletes were there in the 1984 Summer Olympic Games?
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.games_name = '1984 Summer' AND games_competitor.age = 20
Database: olympics
Note: games refer to games_id;
Question: How many games has Prithipal Singh participated in?
SQL: SELECT count(games_competitor.games_id) FROM person INNER JOIN games_competitor ON person.id = games_competitor.person_id WHERE person.full_name = 'Prithipal Singh'
Database: olympics
Note: the 1984 Summer Olympic games refer to games_name = '1984 Summer'; athletes more than 50 years old refer to person_id where age > 50;
Question: State the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old.
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.games_name = '1984 Summer' AND games_competitor.age > 50
Database: olympics
Note: kinds of events refer to event_name; athletics refer to sport_name = 'Athletics';
Question: How many kinds of events does athletics have?
SQL: SELECT count(event.event_name) FROM sport INNER JOIN event ON sport.id = event.sport_id WHERE sport.sport_name = 'Athletics'
Database: olympics
Note: the heaviest athlete refers to full_name where MAX(weight); from Russia refers to region_name = 'Russia';
Question: Who is the heaviest athlete from Russia?
SQL: SELECT person.full_name FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Russia' ORDER BY person.weight DESC LIMIT 1
Database: olympics
Note: the tallest athlete refers to id where MAX(height); from Portugal refers to region_name = 'Portugal';
Question: Give the height of the tallest athlete from Portugal.
SQL: SELECT person.height FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Portugal' ORDER BY person.height DESC LIMIT 1
Database: olympics
Note: host city refers to city_name; the 1968 Winter Olympic games refer to games_name = '1968 Winter';
Question: Tell the host city of the 1968 Winter Olympic Games.
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE games.games_name = '1968 Winter'
Database: olympics
Note: region refers to region_name; the most athletes refer to MAX(COUNT(region_name));
Question: Which region has the most athletes?
SQL: SELECT noc_region.region_name FROM person_region INNER JOIN noc_region ON person_region.region_id = noc_region.id GROUP BY noc_region.region_name ORDER BY count(person_region.person_id) DESC LIMIT 1
Database: olympics
Note: DIVidE(COUNT(id where height > 175), COUNT(id)) as percentage where region_name = 'Vanuatu';
Question: What is the percentage of athletes from Vanuatu who are taller than 175?
SQL: SELECT cast(count(CASE WHEN person.height > 175 THEN 1 ELSE NULL END) AS REAL) * 100 / count(person_region.person_id) FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Vanuatu'
Database: olympics
Note: AVG(weight) where region_name = 'Tonga' and gender = 'M';
Question: Calculate the average weight of male athletes from Tonga.
SQL: SELECT avg(person.weight) FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Tonga' AND person.gender = 'M'
Database: olympics
Note: where it was held refers to city_name; the 1920 Summer refers to games_name = '1920 Summer';
Question: Where was the 1920 Summer held?
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE games.games_name = '1920 Summer'
Database: olympics
Note: From 1900 to 1992 refers to games_year BETWEEN 1900 AND 1992; London refers to city_name = 'London'; games refer to games_name;
Question: From 1900 to 1992, how many games did London host?
SQL: SELECT count(games.id) FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE city.city_name = 'London' AND games.games_year BETWEEN 1900 AND 1992
Database: olympics
Note: Summer games refer to games_id where season = 'Summer'; Paris refers to city_name = 'Paris';
Question: How many Summer games are there that were held in Paris?
SQL: SELECT count(games.id) FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE city.city_name = 'Paris' AND games.season = 'Summer'
Database: olympics
Note: Los Angeles refers to city_name = 'Los Angeles';
Question: Please list all game names that were held in Los Angeles.
SQL: SELECT games.games_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE city.city_name = 'Los Angeles'
Database: olympics
Note: Which city refers to city_name; the most games refer to MAX(COUNT(city_name));
Question: Which city hosted the most games?
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id GROUP BY city.city_name ORDER BY count(city.city_name) DESC LIMIT 1
Database: olympics
Note: Beijing refers to city_name = 'Beijing'; in 2008 refers to games_year = '2008';
Question: What is the game name that was held in Beijing in 2008?
SQL: SELECT games.games_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE city.city_name = 'Beijing' AND games.games_year = 2008
Database: olympics
Note: DIVidE(COUNT(competitor_id where age > 30), COUNT(competitor_id))as percentage where medal_id = 1;
Question: What is the percentage of champions at the age of over 30?
SQL: SELECT cast(count(CASE WHEN games_competitor.age > 30 THEN 1 END) AS REAL) * 100 / count(games_competitor.person_id) FROM competitor_event INNER JOIN games_competitor ON competitor_event.competitor_id = games_competitor.id WHERE competitor_event.medal_id = 1
Database: olympics
Note: 2012 Summer refers to games_name = '2012 Summer';
Question: At which age did A Lamusi participate in 2012 Summer?
SQL: SELECT games_competitor.age FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_name = '2012 Summer' AND person.full_name = 'A Lamusi'
Database: olympics
Note: in 2000 Summer refers to games_name = '2000 Summer'; age = 31;
Question: How many competitors were there who participated in 2000 Summer with age 31?
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.games_name = '2000 Summer' AND games_competitor.age = 31
Database: olympics
Note: male competitors refers to id where gender = 'M'; in 1948 Summer refers to games_name = '1948 Summer';
Question: How many male competitors were there who participated in 1948 Summer?
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_name = '1948 Summer' AND person.gender = 'M'
Database: olympics
Note: competitors' names refer to full_name; in 1936 Summer refers to games_name = '1936 Summer';
Question: Please list all competitors' names who participated in 1936 Summer.
SQL: SELECT person.full_name FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_name = '1936 Summer'
Database: olympics
Note: the youngest competitor refers to full_name where MIN(age); in 2014 Winter refers to games_name = '2014 Winter';
Question: Who is the youngest competitor that participated in 2014 Winter?
SQL: SELECT person.full_name FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_name = '2014 Winter' ORDER BY games_competitor.age LIMIT 1
Database: olympics
Note: AVG(age) where games_name = '1988 Winter';
Question: What is the average age of competitors who participated in 1988 Winter?
SQL: SELECT avg(games_competitor.age) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_name = '1988 Winter'
Database: olympics
Note: DIVidE(COUNT(person_id where gender = 'F' and height > 170), COUNT(person_id)) as percentage where games_year = 1988;
Question: What is the percentage of female competitors whose heights are over 170 that participated in the game in 1988?
SQL: SELECT cast(count(CASE WHEN person.gender = 'F' AND person.height > 170 THEN 1 END) AS REAL) * 100 / count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id INNER JOIN person ON games_competitor.person_id = person.id WHERE games.games_year = 1988
Database: olympics
Note: "Cross Country Skiing Men's 10/15 kilometres Pursuit" refers to event_name = 'Cross Country Skiing Men''s 10/15 kilometres Pursuit';
Question: What is the sport name of "Cross Country Skiing Men's 10/15 kilometres Pursuit" event?
SQL: SELECT sport.sport_name FROM sport INNER JOIN event ON sport.id = event.sport_id WHERE event.event_name LIKE 'Cross Country Skiing Men%s 10/15 kilometres Pursuit'
Database: olympics
Note: DIVidE(COUNT(season = 'Winter' and age > 24), COUNT(person_id)) as percentage;
Question: What is the percentage of people whose age greater than 24 and participate in winter season?
SQL: SELECT cast(count(CASE WHEN games_competitor.age > 24 AND games.season = 'Winter' THEN 1 ELSE NULL END) AS REAL) * 100 / count(games_competitor.games_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id
Database: olympics
Question: What is the region id of Christine Jacoba Aaftink?
SQL: SELECT person_region.region_id FROM person_region INNER JOIN person ON person_region.person_id = person.id WHERE person.full_name = 'Christine Jacoba Aaftink'
Database: olympics
Question: Mention the height of people who belong to region id 7.
SQL: SELECT person.height FROM person_region INNER JOIN person ON person_region.person_id = person.id WHERE person_region.region_id = 7
Database: olympics
Note: name of city refers to city_name;
Question: State the name of the city that held game id 3.
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id WHERE games_city.games_id = 3
Database: olympics
Note: London refers to city_name = 'London';
Question: What are the id of the games held in London?
SQL: SELECT games_city.games_id FROM games_city INNER JOIN city ON games_city.city_id = city.id WHERE city.city_name = 'London'
Database: olympics
Note: people who are below 30 refer to person_id where age < 30; the summer season refers to season = 'Summer';
Question: How many people who are below 30 and participated in the summer season?
SQL: SELECT count(games_competitor.person_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.season = 'Summer' AND games_competitor.age < 30
Database: olympics
Note: name of games refers to games_name;
Question: List out the name of the game that the people participated in games id 13.
SQL: SELECT DISTINCT games.games_name FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games_competitor.games_id = 13
Database: olympics
Note: AVG(age) where season = 'Winter';
Question: What is the average age of the people who participated in the winter season?
SQL: SELECT avg(games_competitor.age) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.season = 'Winter'
Database: olympics
Note: DIVidE(COUNT(age < 35) / COUNT(person_id)) as percentage where season = 'Summer';
Question: What is the percentage of the people who are under 35 and participated in the summer season?
SQL: SELECT cast(count(CASE WHEN games_competitor.age < 35 THEN 1 END) AS REAL) * 100 / count(games_competitor.games_id) FROM games INNER JOIN games_competitor ON games.id = games_competitor.games_id WHERE games.season = 'Summer'
Database: olympics
Note: basketball refers to sport_name = 'Basketball';
Question: State the event name of Basketball.
SQL: SELECT event.event_name FROM sport INNER JOIN event ON sport.id = event.sport_id WHERE sport.sport_name = 'Basketball'
Database: olympics
Note: name of medal refers to medal_name;
Question: What is the name of medal that competitor id 9 obtained?
SQL: SELECT DISTINCT medal.medal_name FROM medal INNER JOIN competitor_event ON medal.id = competitor_event.medal_id WHERE competitor_event.competitor_id = 9
Database: olympics
Note: the gold medal refers to medal_name = 'Gold';
Question: List out the id of event that achieve the gold medal.
SQL: SELECT competitor_event.event_id FROM medal INNER JOIN competitor_event ON medal.id = competitor_event.medal_id WHERE medal.medal_name = 'Gold'
Database: olympics
Note: Who refers to full_name; the heaviest refers to MAX(weight);
Question: Who is the heaviest athlete?
SQL: SELECT full_name FROM person ORDER BY weight DESC LIMIT 1
Database: olympics
Note: city refers to city_name; in 1992 refers to games_year = 1992;
Question: Which city were the Olympic games held in 1992?
SQL: SELECT city.city_name FROM games_city INNER JOIN city ON games_city.city_id = city.id INNER JOIN games ON games_city.games_id = games.id WHERE games.games_year = 1992
Database: olympics
Note: region refers to region_name; the majority of the athletes from refer to MAX(COUNT(region_name));
Question: Which region is the majority of the athletes from?
SQL: SELECT noc_region.region_name FROM person_region INNER JOIN noc_region ON person_region.region_id = noc_region.id GROUP BY noc_region.region_name ORDER BY count(person_region.person_id) DESC LIMIT 1
Database: olympics
Note: name refers to full_name; the oldest refers to MAX(age);
Question: What is the name of the oldest competitor?
SQL: SELECT person.full_name FROM person INNER JOIN games_competitor ON person.id = games_competitor.person_id ORDER BY games_competitor.age DESC LIMIT 1
Database: olympics
Note: sport refers to sport_name;
Question: Which sport did John Aalberg participate in?
SQL: SELECT DISTINCT sport.sport_name FROM sport INNER JOIN event ON sport.id = event.sport_id INNER JOIN competitor_event ON event.id = competitor_event.event_id INNER JOIN games_competitor ON competitor_event.competitor_id = games_competitor.id INNER JOIN person ON games_competitor.person_id = person.id WHERE person.full_name = 'John Aalberg'
Database: olympics
Note: Belgian men refer to gender = 'M' where region_name = 'Belgium';
Question: How many Belgian men have competed in an Olympic Games?
SQL: SELECT count(person_region.person_id) FROM noc_region INNER JOIN person_region ON noc_region.id = person_region.region_id INNER JOIN person ON person_region.person_id = person.id WHERE noc_region.region_name = 'Belgium' AND person.gender = 'M'