input
stringlengths 358
16.1k
| output
stringlengths 24
805
|
---|---|
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Which current legislator has served for more terms, Sherrod Brown or Maria Cantwell? [/INST] | SELECT CASE WHEN SUM(CASE WHEN T1.official_full_name = 'Maria Cantwell' THEN 1 ELSE 0 END) > SUM(CASE WHEN T1.official_full_name = 'Sherrod Brown' THEN 1 ELSE 0 END) THEN 'Maria Cantwell' ELSE 'Sherrod Brown' END FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Among all the current legislators who have served for more than 4 terms, what is the percentage of them being female? [/INST] | SELECT CAST(SUM(CASE WHEN gender_bio = 'F' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.bioguide) FROM ( SELECT T2.bioguide, T1.gender_bio FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide GROUP BY T2.bioguide HAVING COUNT(T2.bioguide) > 4 ) T3; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average number of terms served for a current legislator that's famous or impact? [/INST] | SELECT CAST(COUNT(T2.bioguide) AS REAL) / COUNT(DISTINCT T1.bioguide_id) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.wikipedia_id IS NOT NULL; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: How many of the legislators are female? [/INST] | SELECT COUNT(gender_bio) FROM current WHERE gender_bio = 'F'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the total number of senators New Jersey have? [/INST] | SELECT COUNT(type) FROM `historical-terms` WHERE state = 'NJ' AND type = 'rep'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the address of the legislator with the contact form of http://www.carper.senate.gov/contact/. [/INST] | SELECT address FROM `current-terms` WHERE contact_form = 'http://www.carper.senate.gov/contact/'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the Instagram username of the legislator named Benjamin Hawkins. [/INST] | SELECT T1.instagram FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.first_name = 'Benjamin' AND T2.last_name = 'Hawkins'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Give the alphanumeric ID of the Catholic legislators in Nebraska. [/INST] | SELECT T1.bioguide FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.religion_bio = 'Catholic' AND T1.state = 'NE'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: List down the MapLight ID of the representatives in Maine. [/INST] | SELECT T1.maplight_id FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'rep' AND T2.state = 'ME' GROUP BY T1.maplight_id; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Give the type and start date of the term of the legislator born on November 26, 1727. [/INST] | SELECT T2.type, T2.start FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.birthday_bio = '1727-11-26'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: What is the contact form of the legislator named Rick Crawford? [/INST] | SELECT T2.contact_form FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.official_full_name = 'Rick Crawford'; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: How many female representatives are there in Michigan? [/INST] | SELECT COUNT(T.bioguide_id) FROM ( SELECT T1.bioguide_id FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.type = 'rep' AND T2.state = 'MI' AND T1.gender_bio = 'F' GROUP BY T1.bioguide_id ) T; |
[INST] Here is a database schema:
current :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ]
birthday_bio [ DATE ]
cspan_id [ REAL ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ REAL ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ INTEGER ]
votesmart_id [ REAL ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
current-terms :
address [ TEXT ]
bioguide [ TEXT ] current-terms.bioguide = current.bioguide_id
caucus [ TEXT ]
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
historical :
ballotpedia_id [ TEXT ]
bioguide_id [ TEXT ] primary_key
bioguide_previous_id [ TEXT ]
birthday_bio [ TEXT ]
cspan_id [ TEXT ]
fec_id [ TEXT ]
first_name [ TEXT ]
gender_bio [ TEXT ]
google_entity_id_id [ TEXT ]
govtrack_id [ INTEGER ]
house_history_alternate_id [ TEXT ]
house_history_id [ REAL ]
icpsr_id [ REAL ]
last_name [ TEXT ]
lis_id [ TEXT ]
maplight_id [ TEXT ]
middle_name [ TEXT ]
nickname_name [ TEXT ]
official_full_name [ TEXT ]
opensecrets_id [ TEXT ]
religion_bio [ TEXT ]
suffix_name [ TEXT ]
thomas_id [ TEXT ]
votesmart_id [ TEXT ]
wikidata_id [ TEXT ]
wikipedia_id [ TEXT ]
historical-terms :
address [ TEXT ]
bioguide [ TEXT ] primary_key historical-terms.bioguide = historical.bioguide_id
chamber [ TEXT ]
class [ REAL ]
contact_form [ TEXT ]
district [ REAL ]
end [ TEXT ]
fax [ TEXT ]
last [ TEXT ]
middle [ TEXT ]
name [ TEXT ]
office [ TEXT ]
party [ TEXT ]
party_affiliations [ TEXT ]
phone [ TEXT ]
relation [ TEXT ]
rss_url [ TEXT ]
start [ TEXT ]
state [ TEXT ]
state_rank [ TEXT ]
title [ TEXT ]
type [ TEXT ]
url [ TEXT ]
social-media :
bioguide [ TEXT ] primary_key social-media.bioguide = current.bioguide_id
facebook [ TEXT ]
facebook_id [ REAL ]
govtrack [ REAL ]
instagram [ TEXT ]
instagram_id [ REAL ]
thomas [ INTEGER ]
twitter [ TEXT ]
twitter_id [ REAL ]
youtube [ TEXT ]
youtube_id [ TEXT ]
Please write me a SQL statement that answers the following question: Among the female legislators, what is the percentage of the senators in Maine? [/INST] | SELECT CAST(SUM(CASE WHEN T2.type = 'sen' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.type) FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.state = 'ME' AND T1.gender_bio = 'F'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Please list the names of all the Olympic games that John Aalberg has taken part in. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What was the name of the Olympic game that John Aalberg took part in when he was 31? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: When John Aalberg took part in the 1994 Winter Olympic Game, how old was he? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Olympic competitors are from Finland? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Please list the names of all the Olympic competitors from Finland. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: The Olympic competitor John Aalberg is from which region? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the NOC code of the region where the tallest male Olympic competitor is from? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Among all the Olympic competitors from Finland, how many of them are female? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which city was the 1992 Summer Olympic Games held? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Please list the names of the Olympic games that were held in London. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which year did London hold its earliest Olympic game? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: For how many times has London held the Olympic games? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the average height of the male Olympic competitors from Finland? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Among the competitors of the 1994 Winter Olympic Game, what is the percentage of those from Finland? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which sport does the event "Shooting Women's Trap" belong to? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which city was the host of 1936 Winter Olympic Games? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Olympic Games has London hosted? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Tell the number of swimming related events. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: For Peter Kohnke, show the name of his/her region. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which game has Jessica Carolina Aguilera Aguilera participated in? Give the id of the game. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Show the name of the sport with the most events. [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Give the name of the tallest athlete from Sweden. [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes in the database are from Guatemala? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Who has participated in the most Olympic Games in the database? [/INST] | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id GROUP BY T2.person_id ORDER BY COUNT(T2.person_id) DESC LIMIT 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Show the name of the competitor id 90991. [/INST] | SELECT T1.full_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.id = 90991; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many competitor ids does Martina Kohlov have? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Calculate the bmi of the competitor id 147420. [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the percentage of male athletes from Estonia? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Who is the youngest person who participated in the Olympics? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many 24 years old competitors competed in Men's Basketball? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What are the names of the events under Art Competitions? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many gold medals does Henk Jan Zwolle have? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the name of the event where competitors received the most gold medals? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes are from Australia? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which cities hosted at least 3 Olympic games? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Summer games were held in Stockholm? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which region do most of the athletes are from? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Where was the first Olympic game held? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the name of the game in which the oldest Olympian has ever participated? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes competed in the 1992 Summer Olympics? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Olympic events did Michael Phelps II join in total? Find the percentage of the events where he won a gold medal. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In the Winter and Summer Olympics of 1988, which game has the most number of competitors? Find the difference of the number of competitors between the two games. [/INST] | SELECT P1 , ( SELECT MAX(P2) - MIN(P2) FROM ( SELECT COUNT(T2.person_id) AS P2 FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name IN ('1988 Winter', '1988 Summer') GROUP BY T1.season ) ORDER BY P2 DESC LIMIT 1 ) FROM ( SELECT T1.season AS P1, COUNT(T2.person_id) AS P2 FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name IN ('1988 Winter', '1988 Summer') GROUP BY T1.season ) ORDER BY P2 DESC LIMIT 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What age of the competitors is the most numerous? [/INST] | SELECT age FROM games_competitor GROUP BY age ORDER BY COUNT(person_id) DESC LIMIT 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which cities beginning with the letter M have the Olympic Games been held? [/INST] | SELECT city_name FROM city WHERE city_name LIKE 'M%'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which cities were the 1976 winter and summer games held? [/INST] | 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'); |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What was the medal that Coleen Dufresne got? [/INST] | 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)'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the name of the competitor who has won the most medals? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Where is competitor Estelle Nze Minko from? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the name of all the sports Chin Eei Hui has competed in? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the name of the oldest person who participated in the Olympic Games? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which Olympic Games have the largest number of women participation? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many males from Belgium have participated in an Olympic Games? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many persons participated in the Sapporo Olympics? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: In which Olympic Games has Morten Aleksander Djupvik participated? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many persons in total have participated in 12 meter Mixed Sailing competitions? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many different events are there of Modern Pentathlon? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Calculate the percentage of women who have participated in Equestrianism Mixed Three-Day Event, Individual. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Calculate the average age of the persons who participated in the 1992 Summer Games. [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: List out years that only have summer games. [/INST] | SELECT games_year FROM games WHERE season != 'Winter' GROUP BY games_year HAVING COUNT(season) = 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Olympics games were held during the 90s? [/INST] | SELECT COUNT(games_year) FROM games WHERE games_year BETWEEN '1990' AND '1999'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes participated in the 2014 Winter Olympics? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes from region 151 have won a medal? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athlete from China participate in the 2016 Summer Olympics? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many gold medals were given to the winners in the Ice Hockey Men's Ice Hockey event? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which region has the highest medal number? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: List out all the gold medalist winners in cycling sport. [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: List out all the medals won by Lee Chong Wei. [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the percentage of female athletes below 20s who participated in the 2002 Winter Olympic? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the ratio male to female athletes in the 2012 Summer Olympic? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which summer Olympic have the highest and lowest number of participants? [/INST] | SELECT ( SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' GROUP BY T1.games_year ORDER BY COUNT(T2.person_id) DESC LIMIT 1 ) AS HIGHEST , ( SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' GROUP BY T1.games_year ORDER BY COUNT(T2.person_id) LIMIT 1 ) AS LOWEST; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes from Malaysia have won a medal? [/INST] | 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; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes playing in Canoeing fall into overweight BMI category in the 2008 Summer games? [/INST] | SELECT COUNT(T5.id) 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 INNER JOIN games AS T6 ON T4.games_id = T6.id WHERE T1.sport_name = 'Canoeing' AND T6.games_name = '2008 Summer' AND T5.weight * 10000.0 / (T5.height * T5.height) BETWEEN 25.0 AND 30; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the average height of male athletes playing basketball sport? [/INST] | SELECT AVG(T5.height) 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 T1.sport_name = 'Basketball' AND T5.gender = 'M'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many female athletes are from the Philippines? [/INST] | 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 = 'Philippines' AND T3.gender = 'F'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which region is Yao Ming from? [/INST] | 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 = 'Yao Ming'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: At what age did Michael Fred Phelps, II join the Olympics? [/INST] | SELECT T2.age FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Michael Fred Phelps, II' ORDER BY T2.age LIMIT 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes are there in the region where Clara Hughes is from? [/INST] | SELECT COUNT(person_id) FROM person_region WHERE region_id = ( SELECT T1.region_id FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T2.full_name = 'Clara Hughes' ); |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Men's 200 Metres Freestyle events did Ian James Thorpe compete in? [/INST] | 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 event AS T4 ON T3.event_id = T4.id WHERE T1.full_name = 'Ian James Thorpe' AND T4.event_name LIKE 'Swimming Men%s 200 metres Freestyle'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many times was Larysa Semenivna Latynina (Diriy-) declared as champion in Gymnastics Women's Individual All-Around? [/INST] | SELECT COUNT(T1.id) 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 person AS T4 ON T3.person_id = T4.id WHERE T4.full_name = 'Larysa Semenivna Latynina (Diriy-)' AND T1.event_name LIKE 'Gymnastics Women%s Individual All-Around' AND T2.medal_id = 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What are the names of the cities where Carl Lewis Borack competed? [/INST] | SELECT T4.city_name FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T1.full_name = 'Carl Lewis Borack'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many Olympic games were held in London? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which city was the 1992 Summer Olympic held? [/INST] | 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'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many athletes over the age of 59 competed in the 2016 Summer Olympics? [/INST] | 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 = '2016 Summer' AND T2.age > 59; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Among the Olympic games held in Los Angeles, what is the name of the Olympic game that has the most number of competitors? [/INST] | SELECT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN games_city AS T3 ON T2.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id WHERE T4.city_name = 'Los Angeles' GROUP BY T1.id ORDER BY COUNT(T2.person_id) DESC LIMIT 1; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: How many 10-year old athletes participated in the Gymnastics Men's Parallel Bars, Teams event? [/INST] | 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 'Gymnastics Men%s Parallel Bars, Teams' AND T2.age = 10; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: What is the average age of the athletes from the United States of America who competed in the 2016 Summer Olympics? [/INST] | SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id INNER JOIN person_region AS T3 ON T2.person_id = T3.person_id INNER JOIN noc_region AS T4 ON T3.region_id = T4.id WHERE T1.games_name = '2016 Summer' AND T4.region_name = 'USA'; |
[INST] Here is a database schema:
city :
id [ INTEGER ] primary_key
city_name [ TEXT ]
games :
id [ INTEGER ] primary_key
games_year [ INTEGER ]
games_name [ TEXT ]
season [ TEXT ]
games_city :
games_id [ INTEGER ] games_city.games_id = games.id
city_id [ INTEGER ] games_city.city_id = city.id
medal :
id [ INTEGER ] primary_key
medal_name [ TEXT ]
noc_region :
id [ INTEGER ] primary_key
noc [ TEXT ]
region_name [ TEXT ]
person :
id [ INTEGER ] primary_key
full_name [ TEXT ]
gender [ TEXT ]
height [ INTEGER ]
weight [ INTEGER ]
games_competitor :
id [ INTEGER ] primary_key
games_id [ INTEGER ] games_competitor.games_id = games.id
person_id [ INTEGER ] games_competitor.person_id = person.id
age [ INTEGER ]
person_region :
person_id [ INTEGER ] person_region.person_id = person.id
region_id [ INTEGER ] person_region.region_id = noc_region.id
sport :
id [ INTEGER ] primary_key
sport_name [ TEXT ]
event :
id [ INTEGER ] primary_key
sport_id [ INTEGER ] event.sport_id = sport.id
event_name [ TEXT ]
competitor_event :
event_id [ INTEGER ] competitor_event.event_id = event.id
competitor_id [ INTEGER ] competitor_event.competitor_id = games_competitor.id
medal_id [ INTEGER ] competitor_event.medal_id = medal.id
Please write me a SQL statement that answers the following question: Which region does the NOC code "COL" stand for? [/INST] | SELECT region_name FROM noc_region WHERE noc = 'COL'; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.