Chinastark/bird_dataset huggingface dataset:
Database: legislator
Note: Independent refers to party = 'Independent'; senators refers to type = 'sen'; started the term in 2011 and onwards refers to strftime('%Y', start) >= '2011'; caucused with the Democrat refers to caucus = 'Democrat';
Question: Among the Independent senators that started their term in 2011 and onwards, what are the official full names of the senators that caucused with the Democrat?
SQL: SELECT CURRENT.official_full_name FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE current-terms.party = 'Independent' AND strftime('%Y', current-terms.start) >= '2011' AND current-terms.type = 'sen' AND current-terms.caucus = 'Democrat'
Database: legislator
Note: Jewish legislators refers to religion_bio = 'Jewish'; do not have facebook refers to facebook is null;
Question: How many Jewish legislators do not have facebook?
SQL: SELECT count(t3.bioguide_id) FROM ( SELECT CURRENT.bioguide_id FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE social-media.facebook IS NULL GROUP BY CURRENT.bioguide_id ) t3
Database: legislator
Note: party that has the highest number of legislators refers to MAX(COUNT(party)); Baptist refers to religion_bio = 'Baptist';
Question: Which party has the highest number of legislators who are Baptist?
SQL: SELECT current-terms.party FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.religion_bio = 'Baptist' GROUP BY current-terms.party ORDER BY count(current-terms.party) DESC LIMIT 1
Database: legislator
Note: have facebook, instagram, twitter and youtube accounts refers to 'facebook' is not null AND 'instagram' is not null AND 'twitter' is not null AND 'youtube' is not null;
Question: List the official full names of all the legislators who have facebook, instagram, twitter and youtube accounts.
SQL: SELECT CURRENT.official_full_name FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE social-media.facebook IS NOT NULL AND social-media.instagram IS NOT NULL AND social-media.twitter IS NOT NULL AND social-media.youtube IS NOT NULL
Database: legislator
Question: How many districts did John Conyers, Jr. serve in total?
SQL: SELECT count(t3.district) FROM ( SELECT current-terms.district FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.official_full_name = 'John Conyers, Jr.' GROUP BY current-terms.district ) t3
Database: legislator
Note: Wikipedia page names refers to wikipedia_id; anti-administration refers to party = 'Anti-Administration'; senators refers to type = 'sen';
Question: What are the Wikipedia page names of all the anti-administration senators?
SQL: SELECT historical.wikipedia_id FROM historical INNER JOIN `historical-terms` ON historical.bioguide_id = historical-terms.bioguide WHERE historical-terms.type = 'sen' AND historical-terms.party = 'Anti-Administration'
Database: legislator
Note: served only one district for 26 consecutive years refers to SUBTRACT(SUM(cast(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 26;
Question: List the official full names of all the legislators that served 13 district for 26 consecutive years.
SQL: SELECT DISTINCT CASE WHEN sum(cast(strftime('%Y', current-terms.end) AS int) - cast(strftime('%Y', current-terms.start) AS int)) = 26 THEN CURRENT.official_full_name END FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide GROUP BY CURRENT.official_full_name, current-terms.district HAVING count(CURRENT.official_full_name) = 13
Database: legislator
Note: Federalist refers to party = 'Federalist'; representatives refers to type = 'rep';
Question: How many Federalist representatives are there whose first names are Benjamin?
SQL: SELECT count(t.bioguide_id) FROM ( SELECT historical.bioguide_id FROM historical INNER JOIN `historical-terms` ON historical.bioguide_id = historical-terms.bioguide WHERE historical.first_name = 'Benjamin' AND historical-terms.party = 'Federalist' AND historical-terms.type = 'rep' GROUP BY historical.bioguide_id ) AS t
Database: legislator
Note: female refers to gender_bio = 'F'; representatives refers to type = 'rep'; served for at least 10 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) > 10;
Question: How many female representatives served in the state of California for at least 10 years?
SQL: SELECT sum(t3.result) FROM ( SELECT CASE WHEN sum(cast(strftime('%Y', current-terms.`end`) AS int) - cast(strftime('%Y', current-terms.start) AS int)) > 10 THEN 1 ELSE 0 END AS RESULT FROM CURRENT INNER JOIN "current-terms" ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.gender_bio = 'F' AND current-terms.state = 'CA' AND current-terms.type = 'rep' ) AS t3
Database: legislator
Note: oldest legislator refers to MIN(birthday_bio);
Question: What is the party of the oldest legislator?
SQL: SELECT historical-terms.party FROM `historical-terms` INNER JOIN historical ON historical.bioguide_id = historical-terms.bioguide ORDER BY historical.birthday_bio LIMIT 1
Database: legislator
Note: Lutheran refers to religion_bio = 'Lutheran'; representative refers to type = 'rep'; served for 14 years refers to SUBTRACT(SUM(CAST(strftime('%Y', end)), CAST(strftime('%Y', start)))) = 14;
Question: Who is the Lutheran representative that served in the state of Ohio for 14 years before becoming a senator?
SQL: SELECT CASE WHEN sum(cast(strftime('%Y', current-terms.end) AS int) - cast(strftime('%Y', current-terms.start) AS int)) = 14 THEN official_full_name END FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.religion_bio = 'Lutheran' AND current-terms.state = 'OH' AND current-terms.type = 'rep'
Database: legislator
Note: born after the year 1960 refers to strftime('%Y', birthday_bio) > '1960'; not google entities refers to google_entity_id_id is null;
Question: Among all the current legislators born after the year 1960, how many of them are not google entities?
SQL: SELECT count(*) FROM CURRENT WHERE strftime('%Y', birthday_bio) > '1960' AND google_entity_id_id IS NULL
Database: legislator
Note: have served in the U.S. House refers to house_history_id is not null;
Question: Please list the official full names of all the current legislators who have served in the U.S. House.
SQL: SELECT official_full_name FROM CURRENT WHERE house_history_id IS NOT NULL
Database: legislator
Note: have both accounts on both VoteView.com and maplight.org refers to icpsr_id is not null AND maplight_id is not null;
Question: How many current legislators have both accounts on both VoteView.com and maplight.org?
SQL: SELECT count(*) FROM CURRENT WHERE icpsr_id IS NOT NULL AND maplight_id IS NOT NULL
Database: legislator
Note: female refers to gender_bio = 'F'; have attended in Senate roll call votes refers to lis_id is not null;
Question: Among all the current female legislators, how many of them have attended in Senate roll call votes?
SQL: SELECT count(lis_id) FROM CURRENT WHERE gender_bio = 'F' AND lis_id IS NOT NULL
Database: legislator
Note: religion refers to religion_bio;
Question: What is the religion of current legislator Sherrod Brown?
SQL: SELECT religion_bio FROM CURRENT WHERE official_full_name = 'Sherrod Brown'
Database: legislator
Note: religion with the most occurrrence of the current legislators refers to MAX(count(religion_bio));
Question: What is the religion with the most occurrrence of the current legislators?
SQL: SELECT religion_bio FROM CURRENT GROUP BY religion_bio ORDER BY count(religion_bio) DESC LIMIT 1
Database: legislator
Note: official instagram handle refers to instagram;
Question: What is the current official Instagram handle of current legislator Bob Corker?
SQL: SELECT social-media.instagram FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE CURRENT.official_full_name = 'Bob Corker'
Database: legislator
Note: have accounts on both http://thomas.gov refers to thomas_id is NOT null; have accounts on instagram refers to instagram is not null;
Question: Among the current legislators who have accounts on both http://thomas.gov, how many of them have accounts on instagram?
SQL: SELECT count(DISTINCT CURRENT.bioguide_id) FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE CURRENT.thomas_id IS NOT NULL AND social-media.instagram IS NOT NULL
Database: legislator
Note: username of the current official facebook presence of the legislators refers to facebook; legislators that are famous or impact refers to wikipedia_id is not null;
Question: Please list the username of the current official Facebook presence of all the current legislators that are famous or impact.
SQL: SELECT social-media.facebook FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE CURRENT.wikipedia_id IS NOT NULL GROUP BY social-media.facebook
Database: legislator
Note: oldest legislator refers to MIN(birthday_bio);
Question: For how many terms have the oldest current legislator served?
SQL: SELECT count(current-terms.bioguide) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.birthday_bio = ( SELECT min(birthday_bio) FROM CURRENT )
Database: legislator
Note: Washington, DC office phone number refers to phone; terms starting on 2013/1/3 refers to start = '2013-01-03';
Question: What was current legislator Sherrod Brown's Washington, D.C. office phone number during his term starting on 2013/1/3?
SQL: SELECT current-terms.phone FROM `current-terms` INNER JOIN CURRENT ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.official_full_name = 'Sherrod Brown' AND current-terms.start = '2013-01-03'
Database: legislator
Question: Current legislator Sherrod Brown has been in the Democrat party during how many terms that he has served?
SQL: SELECT count(*) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.official_full_name = 'Sherrod Brown' AND current-terms.party = 'Democrat'
Database: legislator
Note: term that started on 2013/1/3 refers to start = '2013-01-03';
Question: Please list the full official names of all the current legislators who served the term that started on 2013/1/3.
SQL: SELECT CURRENT.official_full_name FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE current-terms.start = '2013-01-03'
Database: legislator
Note: term starting on 2013/1/3 refers to start = '2013-01-03; female refers to gender_bio = 'F';
Question: Among the current legislators who served the term starting on 2013/1/3, how many of them are female?
SQL: SELECT count(*) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE current-terms.start = '2013-01-03' AND CURRENT.gender_bio = 'F'
Database: legislator
Note: served for the most number of terms refers to MAX(COUNT(bioguide));
Question: What is the full official name of the current legislator that has served for the most number of terms?
SQL: SELECT CURRENT.official_full_name FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide GROUP BY CURRENT.official_full_name, current-terms.bioguide ORDER BY count(current-terms.bioguide) DESC LIMIT 1
Database: legislator
Note: district no. 13 refers to district = 13;
Question: For how many terms has current legislator Sherrod Brown served as a representative for district no.13?
SQL: SELECT count(*) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.official_full_name = 'Sherrod Brown' AND current-terms.district = 13
Database: legislator
Note: current official facebook presence is "senjoniernst" refers to facebook = 'senjoniernst';
Question: What is the official full name of the current legislator whose current official Facebook presence is "senjoniernst"?
SQL: SELECT CURRENT.official_full_name FROM CURRENT INNER JOIN `social-media` ON CURRENT.bioguide_id = social-media.bioguide WHERE social-media.facebook = 'senjoniernst'
Database: legislator
Note: if sum(official_full_name = 'Maria Cantwell') > sum(official_full_name = 'Sherrod Brown') then Maria Cantwell has served for more term than Sherrod Brown; if sum(official_full_name = 'Sherrod Brown') > sum(official_full_name = 'Maria Cantwell'), then Sherrod Brown has served for more terms than Maria Cantwell;
Question: Which current legislator has served for more terms, Sherrod Brown or Maria Cantwell?
SQL: SELECT CASE WHEN sum(CASE WHEN CURRENT.official_full_name = 'Maria Cantwell' THEN 1 ELSE 0 END) > sum(CASE WHEN CURRENT.official_full_name = 'Sherrod Brown' THEN 1 ELSE 0 END) THEN 'Maria Cantwell' ELSE 'Sherrod Brown' END FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide
Database: legislator
Note: have served for more than 4 years refers to count(bioguide) > 4; percentage = MULTIPLY(DIVIDE(SUM(gender_bio = 'F'), count(bioguide)), 100.0); female refers to gender_bio = 'F';
Question: Among all the current legislators who have served for more than 4 terms, what is the percentage of them being female?
SQL: SELECT cast(sum(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / count(t3.bioguide) FROM ( SELECT current-terms.bioguide, CURRENT.gender_bio FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide GROUP BY current-terms.bioguide HAVING count(current-terms.bioguide) > 4 ) t3
Database: legislator
Note: average = DIVIDE(COUNT(bioguide), COUNT(bioguide_id)); legislator that's famous or impact refers to wikipedia_id is not null;
Question: What is the average number of terms served for a current legislator that's famous or impact?
SQL: SELECT cast(count(current-terms.bioguide) AS REAL) / count(DISTINCT CURRENT.bioguide_id) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.wikipedia_id IS NOT NULL
Database: legislator
Note: female refers to gender_bio = 'F';
Question: How many of the legislators are female?
SQL: SELECT count(gender_bio) FROM CURRENT WHERE gender_bio = 'F'
Database: legislator
Note: senators refers to type = 'rep'; New Jersey refers to state = 'NJ';
Question: What is the total number of senators New Jersey have?
SQL: SELECT count(TYPE) FROM `historical-terms` WHERE state = 'NJ' AND TYPE = 'rep'
Database: legislator
Question: Provide the address of the legislator with the contact form of http://www.carper.senate.gov/contact/.
SQL: SELECT address FROM `current-terms` WHERE contact_form = 'http://www.carper.senate.gov/contact/'
Database: legislator
Note: instagram username refers to instagram;
Question: Provide the Instagram username of the legislator named Benjamin Hawkins.
SQL: SELECT social-media.instagram FROM `social-media` INNER JOIN CURRENT ON CURRENT.bioguide_id = social-media.bioguide WHERE CURRENT.first_name = 'Benjamin' AND CURRENT.last_name = 'Hawkins'
Database: legislator
Note: alphanumeric ID refers to bioguide; Catholic legislators refers to religion_bio = 'Catholic'; Nebraska refers to state = 'NE';
Question: Give the alphanumeric ID of the Catholic legislators in Nebraska.
SQL: SELECT current-terms.bioguide FROM `current-terms` INNER JOIN CURRENT ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.religion_bio = 'Catholic' AND current-terms.state = 'NE'
Database: legislator
Note: representatives refers to type = 'rep'; Maine refers to state = 'ME';
Question: List down the MapLight ID of the representatives in Maine.
SQL: SELECT historical.maplight_id FROM historical INNER JOIN `historical-terms` ON historical.bioguide_id = historical-terms.bioguide WHERE historical-terms.type = 'rep' AND historical-terms.state = 'ME' GROUP BY historical.maplight_id
Database: legislator
Note: start date of the term refers to start; born on November 26, 1727 refers to birthday_bio = '1727-11-26';
Question: Give the type and start date of the term of the legislator born on November 26, 1727.
SQL: SELECT historical-terms.type, historical-terms.start FROM historical INNER JOIN `historical-terms` ON historical.bioguide_id = historical-terms.bioguide WHERE historical.birthday_bio = '1727-11-26'
Database: legislator
Question: What is the contact form of the legislator named Rick Crawford?
SQL: SELECT current-terms.contact_form FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE CURRENT.official_full_name = 'Rick Crawford'
Database: legislator
Note: female refers to gender_bio = 'F'; representatives refers to type = 'rep'; Michigan refers to state = 'MI';
Question: How many female representatives are there in Michigan?
SQL: SELECT count(t.bioguide_id) FROM ( SELECT CURRENT.bioguide_id FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE current-terms.type = 'rep' AND current-terms.state = 'MI' AND CURRENT.gender_bio = 'F' GROUP BY CURRENT.bioguide_id ) t
Database: legislator
Note: female refers to gender_bio = 'F'; percentage = MULTIPLY(DIVIDE(SUM(type = 'sen'), COUNT(type)), 100.0); senators refers to type = 'sen'; Maine refers to state = 'ME';
Question: Among the female legislators, what is the percentage of the senators in Maine?
SQL: SELECT cast(sum(CASE WHEN current-terms.type = 'sen' THEN 1 ELSE 0 END) AS REAL) * 100 / count(current-terms.type) FROM CURRENT INNER JOIN `current-terms` ON CURRENT.bioguide_id = current-terms.bioguide WHERE current-terms.state = 'ME' AND CURRENT.gender_bio = 'F'
Database: olympics
Note: name of the Olympic games refers to games_name;
Question: Please list the names of all the Olympic games that John Aalberg has taken part in.
SQL: SELECT games.games_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 person.full_name = 'John Aalberg'
Database: olympics
Note: when he was 31 refers to age = 31; name of the Olympic games refers to games_name;
Question: What was the name of the Olympic game that John Aalberg took part in when he was 31?
SQL: SELECT games.games_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 person.full_name = 'John Aalberg' AND games_competitor.age = 31
Database: olympics
Note: how old was he refers to age; 1994 Winter refers to games_name = '1994 Winter';
Question: When John Aalberg took part in the 1994 Winter Olympic Game, how old was he?
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 person.full_name = 'John Aalberg' AND games.games_name = '1994 Winter'
Database: olympics
Note: competitors refer to person_id; from Finland refers to region_name = 'Finland';
Question: How many Olympic competitors are from Finland?
SQL: SELECT count(person_region.person_id) FROM person_region INNER JOIN noc_region ON person_region.region_id = noc_region.id WHERE noc_region.region_name = 'Finland'
Database: olympics
Note: names of competitors refer to full_name; from Finland refers to region_name = 'Finland';
Question: Please list the names of all the Olympic competitors from Finland.
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 = 'Finland'
Database: olympics
Note: from which region refers to region_name;
Question: The Olympic competitor John Aalberg is from which region?
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 = 'John Aalberg'
Database: olympics
Note: noc code of the region refers to noc; male refers to gender = 'M'; the tallest refers to MAX(height);
Question: What is the NOC code of the region where the tallest male Olympic competitor is from?
SQL: SELECT noc_region.noc 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.gender = 'M' ORDER BY person.height DESC LIMIT 1
Database: olympics
Note: competitors from Finland refer to id where region_name = 'Finland'; female refers to gender = 'F';
Question: Among all the Olympic competitors from Finland, how many of them are female?
SQL: SELECT count(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 = 'Finland' AND person.gender = 'F'
Database: olympics
Note: In which city refers to city_name; 1992 Summer Olympic games refer to games_name = '1992 Summer';
Question: In which city was the 1992 Summer Olympic Games 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: held in London refers to city_name = 'London';
Question: Please list the names of the Olympic games that were held in London.
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 = 'London'
Database: olympics
Note: In which year refers to games_year; London refers to city_name = 'London'; earliest Olympic game refers to MIN(games_year);
Question: In which year did London hold its earliest Olympic game?
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 = 'London' ORDER BY games.games_year LIMIT 1
Database: olympics
Note: London refers to city_name = 'London'; how many times refer to COUNT(games_id);
Question: For how many times has London held the Olympic games?
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: DIVidE(SUM(height), COUNT(id)) where region_name = 'Finland' and gender = 'M';
Question: What is the average height of the male Olympic competitors from Finland?
SQL: SELECT avg(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 = 'Finland' AND person.gender = 'M'
Database: olympics
Note: DIVidE(COUNT(id where region_name = 'Finland'), COUNT(id)) as percentage where games_name = '1994 Winter';
Question: Among the competitors of the 1994 Winter Olympic Game, what is the percentage of those from Finland?
SQL: SELECT cast(count(CASE WHEN noc_region.region_name = 'Finland' THEN 1 ELSE NULL END) AS REAL) * 100 / count(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 INNER JOIN person_region ON person.id = person_region.person_id INNER JOIN noc_region ON person_region.region_id = noc_region.id WHERE games.games_name = '1994 Winter'
Database: olympics
Note: sport refers to sport_name; event "Shooting Women's Trap" refers to event_name = 'Shooting Women''s Trap';
Question: Which sport does the event "Shooting Women's Trap" belong to?
SQL: SELECT sport.sport_name FROM sport INNER JOIN event ON sport.id = event.sport_id WHERE event.event_name LIKE 'Shooting Women%s Trap'
Database: olympics
Note: Which city refers to city_name; 1936 Winter Olympic refers to games_name = '1936 Winter';
Question: Which city was the host of 1936 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 = '1936 Winter'
Database: olympics
Note: London refers to city_name = 'London';
Question: How many Olympic Games has London hosted?
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'