input
stringlengths 358
16.1k
| output
stringlengths 24
805
|
---|---|
[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: State the name of sport id 19. [/INST] | SELECT sport_name FROM sport WHERE id = 19; |
[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 id of the event "Shooting Mixed Skeet". [/INST] | SELECT id FROM event WHERE event_name = 'Shooting Mixed Skeet'; |
[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: Provide hockey's sport id. [/INST] | SELECT id FROM sport WHERE sport_name = 'Hockey'; |
[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 weight of Dagfinn Sverre Aarskog. [/INST] | SELECT weight FROM person WHERE full_name = 'Dagfinn Sverre Aarskog'; |
[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 id of Rio de Janeiro? [/INST] | SELECT id FROM city WHERE city_name = 'Rio de Janeiro'; |
[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 people have won the gold medal of the event "Rowing Women's Coxed Eights"? [/INST] | SELECT COUNT(T1.competitor_id) 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 T2.event_name LIKE 'Rowing Women%s Coxed Eights' AND T3.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: How many kinds of events belong to the sport of cycling? [/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 = 'Cycling'; |
[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 Vijay Singh Chauhan's region name? [/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 = 'Vijay Singh Chauhan'; |
[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 did Roma host the Olympic Games? [/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 = 'Roma'; |
[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 20 years old athletes were there in the 1984 Summer Olympic Games? [/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 = '1984 Summer' 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: How many games has Prithipal Singh participated in? [/INST] | SELECT COUNT(T2.games_id) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T1.full_name = 'Prithipal Singh'; |
[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: State the number of athletes in the 1984 Summer Olympic Games who were more than 50 years old. [/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 = '1984 Summer' AND T2.age > 50; |
[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 kinds of events does athletics have? [/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 = 'Athletics'; |
[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 heaviest athlete from Russia? [/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 = 'Russia' ORDER BY T3.weight 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 height of the tallest athlete from Portugal. [/INST] | SELECT 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 = 'Portugal' 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: Tell the host city of the 1968 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 = '1968 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 region has the most athletes? [/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: What is the percentage of athletes from Vanuatu who are taller than 175? [/INST] | SELECT CAST(COUNT(CASE WHEN T3.height > 175 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 = 'Vanuatu'; |
[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 weight of male athletes from Tonga. [/INST] | SELECT AVG(T3.weight) 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 = 'Tonga' 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: Where was the 1920 Summer 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 = '1920 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: From 1900 to 1992, how many games did London host? [/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' AND T3.games_year BETWEEN 1900 AND 1992; |
[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 are there that were held in Paris? [/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 = 'Paris' 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: Please list all game names that were held in Los Angeles. [/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 = 'Los Angeles'; |
[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 hosted the most 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.city_name ORDER BY COUNT(T2.city_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: What is the game name that was held in Beijing in 2008? [/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 = 'Beijing' AND T3.games_year = 2008; |
[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 champions at the age of over 30? [/INST] | SELECT CAST(COUNT(CASE WHEN T2.age > 30 THEN 1 END) AS REAL) * 100 / COUNT(T2.person_id) FROM competitor_event AS T1 INNER JOIN games_competitor AS T2 ON T1.competitor_id = T2.id WHERE T1.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: At which age did A Lamusi participate in 2012 Summer? [/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 T1.games_name = '2012 Summer' AND T3.full_name = 'A Lamusi'; |
[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 competitors were there who participated in 2000 Summer with age 31? [/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 = '2000 Summer' 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: How many male competitors were there who participated in 1948 Summer? [/INST] | SELECT 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 = '1948 Summer' 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: Please list all competitors' names who participated in 1936 Summer. [/INST] | SELECT T3.full_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 T1.games_name = '1936 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: Who is the youngest competitor that participated in 2014 Winter? [/INST] | SELECT T3.full_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 T1.games_name = '2014 Winter' 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: What is the average age of competitors who participated in 1988 Winter? [/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 = '1988 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 is the percentage of female competitors whose heights are over 170 that participated in the game in 1988? [/INST] | SELECT CAST(COUNT(CASE WHEN T3.gender = 'F' AND T3.height > 170 THEN 1 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_year = 1988; |
[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 sport name of "Cross Country Skiing Men's 10/15 kilometres Pursuit" event? [/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 'Cross Country Skiing Men%s 10/15 kilometres Pursuit'; |
[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 people whose age greater than 24 and participate in winter season? [/INST] | SELECT CAST(COUNT(CASE WHEN T2.age > 24 AND T1.season = 'Winter' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id; |
[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 region id of Christine Jacoba Aaftink? [/INST] | SELECT T1.region_id FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T2.full_name = 'Christine Jacoba Aaftink'; |
[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: Mention the height of people who belong to region id 7. [/INST] | SELECT T2.height FROM person_region AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.id WHERE T1.region_id = 7; |
[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: State the name of the city that held game id 3. [/INST] | SELECT T2.city_name FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE 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: What are the id of the games held in London? [/INST] | SELECT 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: How many people who are below 30 and participated in the summer season? [/INST] | SELECT COUNT(T2.person_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = 'Summer' AND T2.age < 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: List out the name of the game that the people participated in games id 13. [/INST] | SELECT DISTINCT T1.games_name FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T2.games_id = 13; |
[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 people who participated in the winter season? [/INST] | SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.season = '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 is the percentage of the people who are under 35 and participated in the summer season? [/INST] | SELECT CAST(COUNT(CASE WHEN T2.age < 35 THEN 1 END) AS REAL) * 100 / COUNT(T2.games_id) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.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: State the event name of Basketball. [/INST] | SELECT T2.event_name FROM sport AS T1 INNER JOIN event AS T2 ON T1.id = T2.sport_id WHERE T1.sport_name = 'Basketball'; |
[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 medal that competitor id 9 obtained? [/INST] | SELECT DISTINCT T1.medal_name FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id WHERE T2.competitor_id = 9; |
[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 the id of event that achieve the gold medal. [/INST] | SELECT T2.event_id FROM medal AS T1 INNER JOIN competitor_event AS T2 ON T1.id = T2.medal_id WHERE T1.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: Who is the heaviest athlete? [/INST] | SELECT full_name FROM person ORDER BY weight 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: Which city were the Olympic games held in 1992? [/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_year = 1992; |
[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 the majority of the athletes 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: What is the name of the oldest competitor? [/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: Which sport did John Aalberg participate 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 = '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: How many Belgian men have competed 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 athletes took part in the Olympic games held in Barcelona? [/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 = 'Barcelona'; |
[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 football events are there? [/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 = 'Football'; |
[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 were the cities in which John Aalberg 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 = '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: In Barcelona, how many Olympic games were held? [/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 = 'Barcelona'; |
[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 competitors over the age of 30 participated in the 1992 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 = '1992 Winter' AND T2.age > 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 name of the Olympic game with the most competitors held in Barcelona? [/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 = 'Barcelona' 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: List the name of competitors from Argentina. [/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 = 'Argentina'; |
[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 Argentina's athletes who participated in the Summer Olympics in 2012? [/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 = '2012 Summer' AND T4.region_name = 'Argentina'; |
[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 bronze medals won by men's basketball players. [/INST] | SELECT CAST(COUNT(CASE WHEN T4.medal_name = 'Bronze' THEN 1 ELSE NULL END) AS REAL) * 100 / 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 INNER JOIN medal AS T4 ON T1.medal_id = T4.id WHERE T3.event_name LIKE 'Basketball Men%s Basketball'; |
[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 the name of the games that Georgios Abaris 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 = 'Georgios Abaris'; |
[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: Provide the name of competitors from Greece. [/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 = 'Greece'; |
[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 competitors who participated in the 1924 Winter. [/INST] | SELECT AVG(T2.age) FROM games AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.games_id WHERE T1.games_name = '1924 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 is the NOC code of the region of the competitors weighted 77 kg? [/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.weight = 77; |
[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 the names of the games held in Paris. [/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 = 'Paris'; |
[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: Provide the competitors' names who joined the 2000 Summer. [/INST] | SELECT T3.full_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 T1.games_name = '2000 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: In which city was the game held where the oldest competitor participated? [/INST] | SELECT T4.city_name FROM games_competitor AS T1 INNER JOIN games AS T2 ON T1.games_id = T2.id INNER JOIN games_city AS T3 ON T1.games_id = T3.games_id INNER JOIN city AS T4 ON T3.city_id = T4.id ORDER BY T1.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: What is the name of the youngest competitor? [/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: List down the games ID of games held in Tokyo. [/INST] | SELECT T1.games_id FROM games_city AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.id WHERE T2.city_name = 'Tokyo'; |
[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 NOC code and region name of the heaviest competitor. [/INST] | SELECT T1.noc, 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 ORDER BY T3.weight 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 what year and season did Sohail Abbas compete? [/INST] | SELECT T1.games_year, T1.season 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 = 'Sohail Abbas'; |
[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 weight of the competitors who won a silver medal? [/INST] | SELECT AVG(T1.weight) 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.medal_name = 'Silver'; |
[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 the 2004 Summer was 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 = '2004 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: What is the season of the game where a competitor who weighted 73 kg and 180 cm tall, participated? [/INST] | SELECT DISTINCT T1.season 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.height = 180 AND T3.weight = 73; |
[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: Provide the names of competitors who received a gold medal. [/INST] | SELECT DISTINCT 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.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: Compute the average height of competitors whose age ranges from 22 to 28. [/INST] | SELECT AVG(T1.height) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE T2.age BETWEEN 22 AND 28; |
[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 competitors were from Iran? [/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 = 'Iran' 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: Provide the age of the tallest competitor. [/INST] | SELECT T2.age FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id ORDER BY T1.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 the competitors with age ranges 24 and below, calculate the difference between the number of competitors who weighed greater than 70 kg and competitors who weighted less than 70 kg. [/INST] | SELECT COUNT(CASE WHEN T1.weight > 70 THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.weight < 70 THEN 1 ELSE NULL END) FROM person AS T1 INNER JOIN games_competitor AS T2 ON T1.id = T2.person_id WHERE 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: In the 2014 Winter game, what is the percentage of competitors who age 28 years old? [/INST] | SELECT CAST(COUNT(CASE WHEN T2.age = 28 THEN 1 END) AS REAL) * 100 / 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: Among the males, list the region name of people with height greater than 87% of the average height of all people listed. [/INST] | SELECT DISTINCT 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.gender = 'M' AND T3.height * 100 > ( SELECT AVG(height) FROM person WHERE gender = 'M' ) * 87; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the total number of households in Arecibo county? [/INST] | SELECT SUM(T1.households) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Which residential area in Arecibo county has the highest average house value? Please give its zip_code. [/INST] | SELECT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' ORDER BY T1.avg_house_value DESC LIMIT 1; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Please list the numbers of males in all the residential areas in Arecibo county. [/INST] | SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Among all the residential areas in Delaware, how many of them implement daylight saving? [/INST] | SELECT COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'DELAWARE' AND T1.daylight_savings = 'Yes'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Among all the residential areas in Arecibo county, what is the zip_code of the one with the highest white population? [/INST] | SELECT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' ORDER BY T1.white_population DESC LIMIT 1; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: In which county is the residential area with the highest average income per household located? [/INST] | SELECT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' GROUP BY T2.county ORDER BY T1.avg_income_per_household DESC LIMIT 1; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Please list the names of all the counties with at least one residential area that implements daylight saving. [/INST] | SELECT DISTINCT T2.county FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.daylight_savings = 'Yes'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Please list the zip_codes of all the residential areas in Huntingdon county with over 30 employees. [/INST] | SELECT DISTINCT T1.zip_code FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'HUNTINGDON' AND T1.employees > 30; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Please list the Asian populations of all the residential areas with the bad alias "URB San Joaquin". [/INST] | SELECT SUM(T1.asian_population) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'URB San Joaquin'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Among the residential areas with the bad alias "Internal Revenue Service", how many of them are in the Eastern time zone? [/INST] | SELECT COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T2.bad_alias = 'Internal Revenue Service' AND T1.time_zone = 'Eastern'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the bad alias of the residential area with the highest average house value? [/INST] | SELECT T2.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: Please list the bad alias of all the residential areas with a median female age of over 32. [/INST] | SELECT DISTINCT T2.bad_alias FROM zip_data AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.female_median_age > 32; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the highest gender ratio of the residential areas in Arecibo county? [/INST] | SELECT CAST(T1.male_population AS REAL) / T1.female_population FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO' AND T1.female_population <> 0 ORDER BY 1 DESC LIMIT 1; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the average median female age of all the residential areas in the Arecibo county? [/INST] | SELECT SUM(T1.female_median_age) / COUNT(T1.zip_code) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'ARECIBO'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the area code of the city with the female median age over 32 years old? [/INST] | SELECT T1.area_code FROM area_code AS T1 INNER JOIN ZIP_Data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.female_median_age > 32 GROUP BY T1.area_code; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: What is the alias of the city called Hartford? [/INST] | SELECT DISTINCT T2.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.city = 'Hartford'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: How many counties are there in Alabama? [/INST] | SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Alabama'; |
[INST] Here is a database schema:
CBSA :
CBSA [ INTEGER ] primary_key
CBSA_name [ TEXT ]
CBSA_type [ TEXT ]
state :
abbreviation [ TEXT ] primary_key
name [ TEXT ]
congress :
cognress_rep_id [ TEXT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
CID [ TEXT ]
party [ TEXT ]
state [ TEXT ]
abbreviation [ TEXT ] congress.abbreviation = state.abbreviation
House [ TEXT ]
District [ INTEGER ]
land_area [ REAL ]
zip_data :
zip_code [ INTEGER ] primary_key
city [ TEXT ]
state [ TEXT ] zip_data.state = state.abbreviation
multi_county [ TEXT ]
type [ TEXT ]
organization [ TEXT ]
time_zone [ TEXT ]
daylight_savings [ TEXT ]
latitude [ REAL ]
longitude [ REAL ]
elevation [ INTEGER ]
state_fips [ INTEGER ]
county_fips [ INTEGER ]
region [ TEXT ]
division [ TEXT ]
population_2020 [ INTEGER ]
population_2010 [ INTEGER ]
households [ INTEGER ]
avg_house_value [ INTEGER ]
avg_income_per_household [ INTEGER ]
persons_per_household [ REAL ]
white_population [ INTEGER ]
black_population [ INTEGER ]
hispanic_population [ INTEGER ]
asian_population [ INTEGER ]
american_indian_population [ INTEGER ]
hawaiian_population [ INTEGER ]
other_population [ INTEGER ]
male_population [ INTEGER ]
female_population [ INTEGER ]
median_age [ REAL ]
male_median_age [ REAL ]
female_median_age [ REAL ]
residential_mailboxes [ INTEGER ]
business_mailboxes [ INTEGER ]
total_delivery_receptacles [ INTEGER ]
businesses [ INTEGER ]
1st_quarter_payroll [ INTEGER ]
annual_payroll [ INTEGER ]
employees [ INTEGER ]
water_area [ REAL ]
land_area [ REAL ]
single_family_delivery_units [ INTEGER ]
multi_family_delivery_units [ INTEGER ]
total_beneficiaries [ INTEGER ]
retired_workers [ INTEGER ]
disabled_workers [ INTEGER ]
parents_and_widowed [ INTEGER ]
spouses [ INTEGER ]
children [ INTEGER ]
over_65 [ INTEGER ]
monthly_benefits_all [ INTEGER ]
monthly_benefits_retired_workers [ INTEGER ]
monthly_benefits_widowed [ INTEGER ]
CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA
alias :
zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code
alias [ TEXT ]
area_code :
zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code
area_code [ INTEGER ]
avoid :
zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code
bad_alias [ TEXT ]
country :
zip_code [ INTEGER ] country.zip_code = zip_data.zip_code
county [ TEXT ]
state [ TEXT ] country.state = state.abbreviation
zip_congress :
zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code
district [ TEXT ] zip_congress.district = congress.cognress_rep_id
Please write me a SQL statement that answers the following question: How many post offices are there in New York? [/INST] | SELECT COUNT(DISTINCT T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'NY' AND T2.type = 'Post Office'; |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.