input
stringlengths 201
2.7k
| output
stringlengths 24
744
|
|---|---|
[INST] Here is a database schema:
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate the average score of university ID 79 between year 2013 to 2015. [/INST] [/INST]
|
SELECT AVG(score) FROM university_ranking_year WHERE year BETWEEN 2013 AND 2015 AND university_id = 79;
|
[INST] Here is a database schema:
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the student staff ratio of university ID 35. [/INST] [/INST]
|
SELECT student_staff_ratio FROM university_year WHERE university_id = 35;
|
[INST] Here is a database schema:
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Provide the score of the most populated university in 2011. [/INST] [/INST]
|
SELECT T2.score FROM university_year AS T1 INNER JOIN university_ranking_year AS T2 ON T1.university_id = T2.university_id WHERE T1.year = 2011 ORDER BY T1.num_students DESC LIMIT 1;
|
[INST] Here is a database schema:
ranking_criteria :
id [ INTEGER ] primary_key
ranking_system_id [ INTEGER ] ranking_criteria.ranking_system_id = ranking_system.id
criteria_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the criteria name where Harvard University scored 100. [/INST] [/INST]
|
SELECT DISTINCT T3.criteria_name FROM university AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.university_id INNER JOIN ranking_criteria AS T3 ON T3.id = T2.ranking_criteria_id WHERE T1.university_name = 'Harvard University' AND T2.score = 100;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
Please write me a SQL statement that answers the following question: Provide the university name and ID of the university found in Turkey. [/INST] [/INST]
|
SELECT T1.university_name, T1.id FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Turkey';
|
[INST] Here is a database schema:
ranking_system :
id [ INTEGER ] primary_key
system_name [ TEXT ]
ranking_criteria :
id [ INTEGER ] primary_key
ranking_system_id [ INTEGER ] ranking_criteria.ranking_system_id = ranking_system.id
criteria_name [ TEXT ]
Please write me a SQL statement that answers the following question: What is the total number of ranking criteria under the ranking system called Shanghai Ranking? [/INST] [/INST]
|
SELECT COUNT(*) FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T1.system_name = 'Shanghai Ranking';
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the name and score of the university ID 124. [/INST] [/INST]
|
SELECT T2.university_name, T1.score FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.id = 124;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: How many female students are there in University of Pennsylvania in 2011? [/INST] [/INST]
|
SELECT CAST(T1.num_students * T1.pct_female_students AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2011 AND T2.university_name = 'University of Pennsylvania';
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: List down all universities that scored below 50. [/INST] [/INST]
|
SELECT DISTINCT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.score < 50;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
Please write me a SQL statement that answers the following question: How many universities are located in Japan? [/INST] [/INST]
|
SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Japan';
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Provide the name of the university with the highest number of male students. [/INST] [/INST]
|
SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id ORDER BY T1.num_students * T1.pct_female_students / 100 - T1.num_students DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: List the countries of universities that scored 70 and below in 2016. [/INST] [/INST]
|
SELECT DISTINCT T3.country_name FROM university AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.score < 70 AND T2.year = 2016;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate number of male students in Emory University in 2011. [/INST] [/INST]
|
SELECT CAST((T1.num_students - (T1.num_students * T1.pct_female_students)) AS REAL) / 100 FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Emory University' AND T1.year = 2011;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
Please write me a SQL statement that answers the following question: In which country does Johns Hopkins University located? [/INST] [/INST]
|
SELECT T2.country_name FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T1.university_name = 'Johns Hopkins University';
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the names of universities with number of students ranges from 400 to 1000. [/INST] [/INST]
|
SELECT DISTINCT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.num_students BETWEEN 400 AND 1000;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: In what year does the Brown University score the highest? [/INST] [/INST]
|
SELECT T1.year FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Brown University' ORDER BY T1.score DESC LIMIT 1;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate the average score of Emory University from 2011 to 2016. [/INST] [/INST]
|
SELECT AVG(T1.score) FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T2.university_name = 'Emory University' AND T1.year BETWEEN 2011 AND 2016;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Give the name of the university with the most number of students in 2015. [/INST] [/INST]
|
SELECT T2.university_name FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 ORDER BY T1.num_students DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: What is the location and number of female students in university ID 23 in 2011? [/INST] [/INST]
|
SELECT T3.country_name, CAST(T2.num_students * T2.pct_female_students AS REAL) / 100 FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T2.year = 2011 AND T1.id = 23;
|
[INST] Here is a database schema:
ranking_criteria :
id [ INTEGER ] primary_key
ranking_system_id [ INTEGER ] ranking_criteria.ranking_system_id = ranking_system.id
criteria_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: How many universities scored 40 in teaching criteria? [/INST] [/INST]
|
SELECT COUNT(*) FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id WHERE T2.score = 40 AND T1.criteria_name = 'Teaching' AND T2.score = 40;
|
[INST] Here is a database schema:
country :
id [ INTEGER ] primary_key
country_name [ TEXT ]
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Among the universities in United States of America, what is the percentage of female students in year 2016? [/INST] [/INST]
|
SELECT SUM(CAST(T2.pct_female_students * T2.num_students AS REAL) / 100) * 100 / SUM(T2.num_students) FROM university AS T1 INNER JOIN university_year AS T2 ON T1.id = T2.university_id INNER JOIN country AS T3 ON T3.id = T1.country_id WHERE T3.country_name = 'United States of America' AND T2.year = 2016;
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_year :
university_id [ INTEGER ] university_year.university_id = university.id
year [ INTEGER ]
num_students [ INTEGER ]
student_staff_ratio [ REAL ]
pct_international_students [ INTEGER ]
pct_female_students [ INTEGER ]
Please write me a SQL statement that answers the following question: Calculate the difference between the total number of students and the number of international international students in Univeristy of Tokyo from 2011 to 2014. [/INST] [/INST]
|
SELECT SUM(T1.num_students) - SUM(CAST(T1.num_students * T1.pct_international_students AS REAL) / 100) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year BETWEEN 2011 AND 2014 AND T2.university_name = 'University of Tokyo';
|
[INST] Here is a database schema:
university :
id [ INTEGER ] primary_key
country_id [ INTEGER ] university.country_id = country.id
university_name [ TEXT ]
university_ranking_year :
university_id [ INTEGER ] university_ranking_year.university_id = university.id
ranking_criteria_id [ INTEGER ] university_ranking_year.ranking_criteria_id = ranking_criteria.id
year [ INTEGER ]
score [ INTEGER ]
Please write me a SQL statement that answers the following question: List the names of universities with a score less than 28% of the average score of all universities in 2015. [/INST] [/INST]
|
SELECT T2.university_name FROM university_ranking_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2015 AND T1.score * 100 < ( SELECT AVG(score) * 28 FROM university_ranking_year WHERE year = 2015 );
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest? [/INST] [/INST]
|
SELECT t2.units FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T1.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T2.item_nbr = 5 ORDER BY t3.tmax - t3.tmin DESC LIMIT 1;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many units of item no.5 were sold in store no.3 in total on days with a total precipitation of over 0.05? [/INST] [/INST]
|
SELECT SUM(CASE WHEN T3.preciptotal > 0.05 THEN units ELSE 0 END) AS sum FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN weather AS T3 ON T2.station_nbr = T3.station_nbr WHERE T2.store_nbr = 3 AND T1.item_nbr = 5;
|
[INST] Here is a database schema:
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Give the id of the weather station with most stores. [/INST] [/INST]
|
SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(station_nbr) DESC LIMIT 1;
|
[INST] Here is a database schema:
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Which weather station does store no.20 belong to? [/INST] [/INST]
|
SELECT station_nbr FROM relation WHERE store_nbr = 20;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: For the weather station which recorded the highest temperature above the 30-year normal, how many stores does it have? [/INST] [/INST]
|
SELECT store_nbr FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY depart DESC LIMIT 1 );
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Give the number of stores which opened on the weather station that recorded the fastest average wind speed. [/INST] [/INST]
|
SELECT COUNT(T.store_nbr) FROM ( SELECT DISTINCT store_nbr FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 ) ) T;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: State the number of stores that belongs to the weather station which recorded the deepest snowfall. [/INST] [/INST]
|
SELECT T2.store_nbr FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr ORDER BY snowfall DESC LIMIT 1;
|
[INST] Here is a database schema:
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many stores are in weather station 12? [/INST] [/INST]
|
SELECT SUM(store_nbr) FROM relation WHERE station_nbr = 12;
|
[INST] Here is a database schema:
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Which weather station has the highest number of stores? [/INST] [/INST]
|
SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Which weather station does the store that sold the highest quantity of item 9 belongs to? [/INST] [/INST]
|
SELECT station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.item_nbr = 9 GROUP BY T2.station_nbr ORDER BY SUM(T1.units) DESC LIMIT 1;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many stores belong to the most windy station? [/INST] [/INST]
|
SELECT COUNT(store_nbr) FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 );
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: Which station sold the highest quantity of item number 5 overall? [/INST] [/INST]
|
SELECT T2.station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.item_nbr = 5 GROUP BY T2.station_nbr ORDER BY SUM(T1.units) DESC LIMIT 1;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: What are the top 3 stations that have sold the highest quantities for an item in a single day? [/INST] [/INST]
|
SELECT T2.station_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr ORDER BY T1.units DESC LIMIT 3;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many stores belong to the station with the highest recorded heat of all time? [/INST] [/INST]
|
SELECT COUNT(T2.store_nbr) FROM ( SELECT station_nbr FROM weather ORDER BY heat DESC LIMIT 1 ) AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
Please write me a SQL statement that answers the following question: What is the maximum average speed? [/INST] [/INST]
|
SELECT MAX(avgspeed) FROM weather;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
Please write me a SQL statement that answers the following question: What is the minimum dew point? [/INST] [/INST]
|
SELECT MIN(dewpoint) FROM weather;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many units of item 7 have been sold by store 7 when the snow is less than 5 inches? [/INST] [/INST]
|
SELECT SUM(units) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T2.store_nbr = 7 AND T3.item_nbr = 7 AND T1.snowfall < 5;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: How many items were sold by store 9 during a snowy day? [/INST] [/INST]
|
SELECT COUNT(DISTINCT item_nbr) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr INNER JOIN sales_in_weather AS T3 ON T2.store_nbr = T3.store_nbr WHERE T3.store_nbr = 9 AND T1.snowfall <> 0 AND T1.snowfall IS NOT NULL;
|
[INST] Here is a database schema:
sales_in_weather :
date [ DATE ]
store_nbr [ INTEGER ]
item_nbr [ INTEGER ]
units [ INTEGER ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: List out stations number and items sold by store 17. [/INST] [/INST]
|
SELECT T1.station_nbr, T2.item_nbr FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.store_nbr = 17 GROUP BY T1.station_nbr, T2.item_nbr;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: What is the sea level and average speed for store number 3 and store number 4? [/INST] [/INST]
|
SELECT T1.sealevel, T1.avgspeed FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 3 OR T2.store_nbr = 4;
|
[INST] Here is a database schema:
weather :
station_nbr [ INTEGER ]
date [ DATE ]
tmax [ INTEGER ]
tmin [ INTEGER ]
tavg [ INTEGER ]
depart [ INTEGER ]
dewpoint [ INTEGER ]
wetbulb [ INTEGER ]
heat [ INTEGER ]
cool [ INTEGER ]
sunrise [ TEXT ]
sunset [ TEXT ]
codesum [ TEXT ]
snowfall [ REAL ]
preciptotal [ REAL ]
stnpressure [ REAL ]
sealevel [ REAL ]
resultspeed [ REAL ]
resultdir [ INTEGER ]
avgspeed [ REAL ]
relation :
store_nbr [ INTEGER ] primary_key relation.store_nbr = sales_in_weather.store_nbr
station_nbr [ INTEGER ] relation.station_nbr = weather.station_nbr
Please write me a SQL statement that answers the following question: What is the ratio of the highest and lowest temperature in store 11? [/INST] [/INST]
|
SELECT CAST((MAX(T1.tmax) - MIN(T1.tmin)) AS REAL) / MIN(T1.tmin) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 11;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: In which country does Polish found least in? [/INST] [/INST]
|
SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'Polish' GROUP BY T2.Name, T1.Percentage ORDER BY T1.Percentage ASC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which countries have more than 90% of African? List the name of the country in full. [/INST] [/INST]
|
SELECT T2.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Name = 'African' AND T1.Percentage > 90;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: State the different ethnic group and percentage of the language in Singapore. [/INST] [/INST]
|
SELECT T1.Name, T1.Percentage FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T2.Name = 'Singapore' GROUP BY T1.Name, T1.Percentage;
|
[INST] Here is a database schema:
politics :
Country [ TEXT ] primary_key
Independence [ DATE ]
Dependent [ TEXT ]
Government [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the percentage of country which gained independence as republic after 1970. [/INST] [/INST]
|
SELECT CAST(SUM(CASE WHEN Government = 'republic' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics WHERE STRFTIME('%Y', Independence) > '1970';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
politics :
Country [ TEXT ] primary_key
Independence [ DATE ]
Dependent [ TEXT ]
Government [ TEXT ]
Please write me a SQL statement that answers the following question: Find the GPD for Bosnia and Herzegovina and the type of government it belongs to. [/INST] [/INST]
|
SELECT T1.GDP, T2.Government FROM economy AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country INNER JOIN country AS T3 ON T3.Code = T2.Country WHERE T3.Name = 'Bosnia and Herzegovina';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: State the country and its population with population growth greater than 2% but infant mortality rate less than 5%. [/INST] [/INST]
|
SELECT T1.Name, T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth > 2 AND T2.Infant_Mortality < 5;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which is the majority of the ethnic group in country with great than 10,000,000 population [/INST] [/INST]
|
SELECT T2.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Population > 10000000 GROUP BY T2.Name, T2.Percentage ORDER BY T2.Percentage DESC LIMIT 2;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Provide the country with its full name which has the most ethnic group? List them all ethnic group together with its percentage. [/INST] [/INST]
|
SELECT T1.Name, T2.Name, T2.Percentage FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T1.Name = ( SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1 ) GROUP BY T1.Name, T2.Name, T2.Percentage;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: What is the full name of the country with 100% Africans? [/INST] [/INST]
|
SELECT T1.Name FROM ethnicGroup AS T1 INNER JOIN country AS T2 ON T1.Country = T2.Code WHERE T1.Percentage = 100 AND T1.Name = 'African';
|
[INST] Here is a database schema:
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: List the infant mortality of country with the least Amerindian. [/INST] [/INST]
|
SELECT T1.Infant_Mortality FROM population AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Country = T2.Country WHERE T2.Name = 'Amerindian' ORDER BY T2.Percentage ASC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: For country with area greater than 600000, what is agriculture percentage of GDP the country contributes? [/INST] [/INST]
|
SELECT T2.Agriculture FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Area > 600000 AND T2.Agriculture IS NOT NULL;
|
[INST] Here is a database schema:
politics :
Country [ TEXT ] primary_key
Independence [ DATE ]
Dependent [ TEXT ]
Government [ TEXT ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: Provide the country with republic government which has the highest population growth? [/INST] [/INST]
|
SELECT T2.Country FROM population AS T1 INNER JOIN politics AS T2 ON T1.Country = T2.Country WHERE T2.Government = 'republic' ORDER BY T1.Population_Growth DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
politics :
Country [ TEXT ] primary_key
Independence [ DATE ]
Dependent [ TEXT ]
Government [ TEXT ]
Please write me a SQL statement that answers the following question: When did 'Bulgaria' gain independence? [/INST] [/INST]
|
SELECT T2.Independence FROM country AS T1 INNER JOIN politics AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Bulgaria';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Calculate the population of Arab in each country? [/INST] [/INST]
|
SELECT T2.Percentage * T1.Population FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Arab';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: What is the population of African in 'Turks and Caicos Islands'? [/INST] [/INST]
|
SELECT T2.Percentage * T1.Population FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'African' AND T1.Name = 'Turks and Caicos Islands';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: What is the number of growth population for country with the lowest infant mortality? [/INST] [/INST]
|
SELECT T2.Population_Growth * T1.Population FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Infant_Mortality IS NOT NULL ORDER BY T2.Infant_Mortality ASC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Among countries with more than 400,000 GDP, state its capital and population. [/INST] [/INST]
|
SELECT T1.Capital, T1.Population FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 400000;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Calculate the service of GDP for Brazil. [/INST] [/INST]
|
SELECT T2.Service * T2.GDP FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Brazil';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the highest infant mortality? Also state its population growth. [/INST] [/INST]
|
SELECT T1.Name, T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country ORDER BY T2.Infant_Mortality DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: List all countries with negative growth in population. State the country, population and growth. [/INST] [/INST]
|
SELECT T1.Name, T1.Population, T2.Population_Growth FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T2.Population_Growth < 0;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: For countries with area between 500000 to 1000000, state the country and infant mortality rate. [/INST] [/INST]
|
SELECT T1.Name, T2.Infant_Mortality FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T1.Area BETWEEN 500000 AND 1000000;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries with more than 3% population growth rate, state the country name in full along with its GDP. [/INST] [/INST]
|
SELECT T1.Name, T3.GDP FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country INNER JOIN economy AS T3 ON T3.Country = T2.Country WHERE T2.Population_Growth > 3;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: What is the infant mortality rate for Ethiopia? [/INST] [/INST]
|
SELECT T2.Infant_Mortality FROM country AS T1 INNER JOIN population AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Ethiopia';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: How much does the gross domestic products goes to the industry sector for Singapore? [/INST] [/INST]
|
SELECT T2.GDP * T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Singapore';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: How much is her GDP in agriculture for the country with the least area? [/INST] [/INST]
|
SELECT T2.GDP * T2.Agriculture FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T1.Area ASC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the biggest percentage of the albanian ethnic group? [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Albanian' ORDER BY T2.Percentage DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries with the African ethnic group, how many of them has a population of over 10000000? [/INST] [/INST]
|
SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'African' AND T1.Area > 10000000;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Please list the name of the countries with over 5 ethnic groups. [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN ethnicGroup AS T2 ON T1.Code = T2.Country GROUP BY T1.Name HAVING COUNT(T1.Name) > 5;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the highest GDP? [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries with a population of over 10000000, how many of them have a GDP of over 500000? [/INST] [/INST]
|
SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.GDP > 500000 AND T1.Population > 10000000;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Please list the capital cities of the countries with an inflation rate under 2. [/INST] [/INST]
|
SELECT T1.Capital FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Inflation < 2;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the lowest inflation rate? [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Inflation IS NOT NULL ORDER BY T2.Inflation ASC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries whose agriculture percentage of the GDP is under 50%, how many of them have an area of over 8000000? [/INST] [/INST]
|
SELECT COUNT(T1.Name) FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T2.Agriculture < 50 AND T1.Area > 8000000;
|
[INST] Here is a database schema:
lake :
Name [ TEXT ] primary_key
Area [ REAL ]
Depth [ REAL ]
Altitude [ REAL ]
Type [ TEXT ]
River [ TEXT ]
Longitude [ REAL ]
Latitude [ REAL ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Please write me a SQL statement that answers the following question: How many cities have a salt lake located in it? [/INST] [/INST]
|
SELECT COUNT(T1.City) FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T2.Type = 'salt';
|
[INST] Here is a database schema:
lake :
Name [ TEXT ] primary_key
Area [ REAL ]
Depth [ REAL ]
Altitude [ REAL ]
Type [ TEXT ]
River [ TEXT ]
Longitude [ REAL ]
Latitude [ REAL ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Please write me a SQL statement that answers the following question: Please list the depth of the lakes that are located in the Province of Albania. [/INST] [/INST]
|
SELECT T2.Depth FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Albania';
|
[INST] Here is a database schema:
lake :
Name [ TEXT ] primary_key
Area [ REAL ]
Depth [ REAL ]
Altitude [ REAL ]
Type [ TEXT ]
River [ TEXT ]
Longitude [ REAL ]
Latitude [ REAL ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Please write me a SQL statement that answers the following question: The lake with the highest altitude is located in which city? [/INST] [/INST]
|
SELECT T2.City FROM lake AS T1 LEFT JOIN located AS T2 ON T2.Lake = T1.Name ORDER BY T1.Altitude DESC LIMIT 1;
|
[INST] Here is a database schema:
lake :
Name [ TEXT ] primary_key
Area [ REAL ]
Depth [ REAL ]
Altitude [ REAL ]
Type [ TEXT ]
River [ TEXT ]
Longitude [ REAL ]
Latitude [ REAL ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Please write me a SQL statement that answers the following question: How many lakes in the Canary Islands cover an area of over 1000000? [/INST] [/INST]
|
SELECT COUNT(T2.Name) FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name WHERE T1.Province = 'Canary Islands' AND T2.Area > 1000000;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the most languages spoken? [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country GROUP BY T1.Name ORDER BY COUNT(T2.Name) DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: What is the capital city of the country that has the percentage of Armenian speakers over 90%? [/INST] [/INST]
|
SELECT T1.Capital FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Armenian' AND T2.Percentage > 90;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries with a population of under 1000000, how many of them have over 2 languages? [/INST] [/INST]
|
SELECT T2.Country FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000 GROUP BY T2.Country HAVING COUNT(T1.Name) > 2;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: How many organizations are founded in countries with a population of under 1000000? [/INST] [/INST]
|
SELECT COUNT(T2.Name) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country WHERE T1.Population < 1000000;
|
[INST] Here is a database schema:
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: How many organizations are established after 1999/1/1 in a country whose GDP is under 500000? [/INST] [/INST]
|
SELECT T1.Country, COUNT(T1.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.GDP < 500000 AND STRFTIME('%Y', T2.Established) < '1999' GROUP BY T1.Country;
|
[INST] Here is a database schema:
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: Among the countries with over 3 organizations, how many of them have an inflation rate of over 5%? [/INST] [/INST]
|
SELECT COUNT(T2.Country) FROM economy AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM organization GROUP BY Country HAVING COUNT(Country) > 3 ) AND T1.Inflation > 5;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
ethnicGroup :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: How many organizations are established in the country with the most ethnic groups? [/INST] [/INST]
|
SELECT COUNT(T2.Province) FROM country AS T1 INNER JOIN organization AS T2 ON T1.Code = T2.Country INNER JOIN ethnicGroup AS T3 ON T3.Country = T2.Country GROUP BY T1.Name ORDER BY COUNT(T3.Name) DESC LIMIT 1;
|
[INST] Here is a database schema:
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: Please list the organization names established in the countries where Dutch is spoken. [/INST] [/INST]
|
SELECT T2.Name FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Dutch';
|
[INST] Here is a database schema:
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
organization :
Abbreviation [ TEXT ] primary_key
Name [ TEXT ]
City [ TEXT ]
Country [ TEXT ]
Province [ TEXT ]
Established [ DATE ]
Please write me a SQL statement that answers the following question: How many organizations are established in countries where people speak Bosnian? [/INST] [/INST]
|
SELECT COUNT(T2.Name) FROM language AS T1 INNER JOIN organization AS T2 ON T1.Country = T2.Country WHERE T1.Name = 'Bosnian';
|
[INST] Here is a database schema:
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: What is the highest infant mortality rate per thousand of the countries whose inflation is under 3? [/INST] [/INST]
|
SELECT MAX(T2.Infant_Mortality) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.Inflation < 3;
|
[INST] Here is a database schema:
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: Among the countries whose GDP is over 1000000, how many of them have a population groth rate of over 3%? [/INST] [/INST]
|
SELECT COUNT(T1.Country) FROM economy AS T1 INNER JOIN population AS T2 ON T1.Country = T2.Country WHERE T1.GDP > 1000000 AND T2.Population_Growth > 3;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Which country has the highest GDP per capita? [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country ORDER BY T2.GDP / T1.Population DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
lake :
Name [ TEXT ] primary_key
Area [ REAL ]
Depth [ REAL ]
Altitude [ REAL ]
Type [ TEXT ]
River [ TEXT ]
Longitude [ REAL ]
Latitude [ REAL ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Please write me a SQL statement that answers the following question: What is the highest lake area coverage of a country? [/INST] [/INST]
|
SELECT T2.Area * 100 / T3.Area FROM located AS T1 INNER JOIN lake AS T2 ON T1.Lake = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country ORDER BY T2.Longitude DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
language :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
population :
Country [ TEXT ] primary_key
Population_Growth [ REAL ]
Infant_Mortality [ REAL ]
Please write me a SQL statement that answers the following question: What is the average population growth rate of countries where more than 3 languages are used? [/INST] [/INST]
|
SELECT SUM(T3.Population_Growth) / COUNT(T3.Country) FROM country AS T1 INNER JOIN language AS T2 ON T1.Code = T2.Country INNER JOIN population AS T3 ON T3.Country = T2.Country WHERE T2.Country IN ( SELECT Country FROM language GROUP BY Country HAVING COUNT(Country) > 3 ) GROUP BY T3.Country;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
economy :
Country [ TEXT ] primary_key
GDP [ REAL ]
Agriculture [ REAL ]
Service [ REAL ]
Industry [ REAL ]
Inflation [ REAL ]
Please write me a SQL statement that answers the following question: Please list the names of the countries with an inflation rate that's 30% above the average. [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country GROUP BY T1.Name, T2.Inflation HAVING T2.Inflation > AVG(T2.Inflation) * 1.3;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
Please write me a SQL statement that answers the following question: Where country does Baghdad belongs to? [/INST] [/INST]
|
SELECT Name FROM country WHERE Province = 'Baghdad';
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
religion :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which religion has the largest population in Martinique? [/INST] [/INST]
|
SELECT T2.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T1.Name = 'Martinique' ORDER BY T1.population DESC LIMIT 1;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
religion :
Country [ TEXT ]
Name [ TEXT ]
Percentage [ REAL ]
Please write me a SQL statement that answers the following question: Which country is 41% Christian? Give the full name of the country. [/INST] [/INST]
|
SELECT T1.Name FROM country AS T1 INNER JOIN religion AS T2 ON T1.Code = T2.Country WHERE T2.Name = 'Christian' AND T2.Percentage = 41;
|
[INST] Here is a database schema:
country :
Name [ TEXT ]
Code [ TEXT ] primary_key
Capital [ TEXT ]
Province [ TEXT ]
Area [ REAL ]
Population [ INTEGER ]
located :
City [ TEXT ]
Province [ TEXT ]
Country [ TEXT ]
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
river :
Name [ TEXT ] primary_key
River [ TEXT ]
Lake [ TEXT ]
Sea [ TEXT ]
Length [ REAL ]
SourceLongitude [ REAL ]
SourceLatitude [ REAL ]
Mountains [ TEXT ]
SourceAltitude [ REAL ]
EstuaryLongitude [ REAL ]
EstuaryLatitude [ REAL ]
Please write me a SQL statement that answers the following question: Which two countries does the Detroit River flow through? Give the full name of the country. [/INST] [/INST]
|
SELECT T3.Name FROM located AS T1 INNER JOIN river AS T2 ON T1.River = T2.Name INNER JOIN country AS T3 ON T3.Code = T1.Country WHERE T2.Name = 'Detroit River';
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.