db_id stringclasses 69 values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 |
|---|---|---|---|
university | Which ranking system is criteria "Total Shanghai" in? | criteria "Total Shanghai" refers to criteria_name = 'Total Shanghai'; which ranking system refers to system_name | SELECT T1.system_name FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id WHERE T2.criteria_name = 'Total Shanghai' |
university | How many female students were there in Pierre and Marie Curie University in 2015? | female students refers to DIVIDE(MULTIPLY(pct_female_students, num_students), 100); in Pierre and Marie Curie University refers to university_name = 'Pierre and Marie Curie University'; in 2015 refers to year = 2015 | 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 = 2015 AND T2.university_name = 'Pierre and Marie Curie University' |
university | What was the score for University of Florida in "N and S" in 2014? | University of Florida refers to university_name = 'University of Florida'; in 2014 refers to year = 2014; in "N and S" refers to criteria_name = 'N and S' | SELECT T2.score FROM ranking_criteria AS T1 INNER JOIN university_ranking_year AS T2 ON T1.id = T2.ranking_criteria_id INNER JOIN university AS T3 ON T3.id = T2.university_id WHERE T3.university_name = 'University of Florida' AND T2.year = 2014 AND T1.criteria_name = 'N and S' |
university | Calculate the number of international students of University of Wisconsin-Madison in 2013. | international students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); University of Wisconsin-Madison refers to university_name = 'University of Wisconsin-Madison'; in 2013 refers to year = 2013 | SELECT 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 = 2013 AND T2.university_name = 'University of Wisconsin-Madison' |
university | Show the name of the university with the lowest number of students in 2015. | lowest number of students refers to MIN(num_students); in 2015 refers to year = 2015; name of university refers to university_name; | 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 ASC LIMIT 1 |
university | How many times more was the number of students of University of Ottawa than Joseph Fourier University in 2013? | Joseph Fourier University refers to university_name = 'Joseph Fourier University'; University of Ottawa refers to university_name = 'University of Ottawa'; in 2013 refers to year = 2013; how many times more refers to DIVIDE(SUM(num_students where university_name = 'University of Ottawa'), SUM(num_students where university_name = 'Joseph Fourier University')) | SELECT CAST(SUM(CASE WHEN T2.university_name = 'University of Ottawa' THEN T1.num_students ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.university_name = 'Joseph Fourier University' THEN T1.num_students ELSE 0 END) FROM university_year AS T1 INNER JOIN university AS T2 ON T1.university_id = T2.id WHERE T1.year = 2013 |
university | Calculate the average number of criterias among "Times Higher Education World University Ranking","Shanghai Ranking" and "Center for World University Rankings". | average number of criterias refers to DIVIDE(SUM(id), 3); "Times Higher Education World University Ranking", "Shanghai Ranking" and "Center for World University Rankings" refers to system_name IN ('Times Higher Education World University Ranking', 'Shanghai Ranking', 'Center for World University Rankings'); | SELECT (SUM(CASE WHEN T1.system_name = 'Center for World University Rankings' THEN 1 ELSE 0 END) + SUM(CASE WHEN T1.system_name = 'Shanghai Ranking' THEN 1 ELSE 0 END) + SUM(CASE WHEN T1.system_name = 'Times Higher Education World University Ranking' THEN 1 ELSE 0 END)) / 3 FROM ranking_system AS T1 INNER JOIN ranking_criteria AS T2 ON T1.id = T2.ranking_system_id |
university | Calculate the average number of students of all universities in 2012. | average number of students refers to avg(num_students); in 2012 refers to year = 2012 | SELECT AVG(num_students) FROM university_year WHERE year = 2012 |
university | What is the score of university ID 68 in 2015? | in 2015 refers to year = 2015 | SELECT score FROM university_ranking_year WHERE year = 2015 AND university_id = 68 |
university | Provide the country ID of Cyprus. | Cyprus refers to country_name = 'Cyprus'; | SELECT id FROM country WHERE country_name = 'Cyprus' |
university | What is the ID of university with the largest percentage of international students? | largest percentage of international students refers to MAX(pct_international_students); ID of university refers to university_id | SELECT university_id FROM university_year ORDER BY pct_international_students DESC LIMIT 1 |
university | Provide the criteria name of the ranking criteria ID 13. | SELECT criteria_name FROM ranking_criteria WHERE id = 13 | |
university | What is the average score of all universities in 2012? | average score refers to avg(score); in 2012 refers to year = 2012 | SELECT AVG(score) FROM university_ranking_year WHERE year = 2012 |
university | In years 2011 to 2013, what is the total number of female students in university ID 40? | total number of female students refers to SUM(DIVIDE(MULTIPLY(pct_female_students, num_students), 100)); In years 2011 to 2013 refers to year BETWEEN 2011 AND 2013 | SELECT SUM(CAST(num_students * pct_female_students AS REAL) / 100) FROM university_year WHERE year BETWEEN 2011 AND 2013 AND university_id = 40 |
university | Calculate the average score of university ID 79 between year 2013 to 2015. | average score refers to avg(score); between year 2013 to 2015 refers to year BETWEEN 2013 AND 2015 | SELECT AVG(score) FROM university_ranking_year WHERE year BETWEEN 2013 AND 2015 AND university_id = 79 |
university | Give the student staff ratio of university ID 35. | SELECT student_staff_ratio FROM university_year WHERE university_id = 35 | |
university | Provide the score of the most populated university in 2011. | most populated university refers to MAX(num_students); in 2011 refers to year = 2011; | 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 |
university | Give the criteria name where Harvard University scored 100. | Harvard University refers to university_name = 'Harvard University'; scored 100 refers to score = 100 | 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 |
university | Provide the university name and ID of the university found in Turkey. | found in Turkey refers to country_name = 'Turkey'; | 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' |
university | What is the total number of ranking criteria under the ranking system called Shanghai Ranking? | ranking system called Shanghai Ranking refers to system_name = 'Shanghai Ranking'; | 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' |
university | Give the name and score of the university ID 124. | name of university refers to university_name; | 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 |
university | How many female students are there in University of Pennsylvania in 2011? | in 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); University of Pennsylvania refers to a university name; | 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' |
university | List down all universities that scored below 50. | scored below 50 refers to score < 50; all universities refers to university_name; | 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 |
university | How many universities are located in Japan? | located in Japan refers to country_name = 'Japan'; | SELECT COUNT(*) FROM university AS T1 INNER JOIN country AS T2 ON T1.country_id = T2.id WHERE T2.country_name = 'Japan' |
university | Provide the name of the university with the highest number of male students. | highest number of female students refers to MAX(SUBTRACT(num_students, DIVIDE(MULTIPLY(num_students, pct_female_students), 100))); name of university refers to university_name | 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 |
university | List the countries of universities that scored 70 and below in 2016. | scored 70 and below refers to score < 70; in 2016 refers to year = 2016 | 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 |
university | Calculate number of male students in Emory University in 2011. | in 2011 refers to year 2011; number of male students refers to SUBTRACT(num_students, DIVIDE(MULTIPLY(num_students, pct_male_students), 100)); in Emory University refers to university_name = 'Emory University' | 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 |
university | In which country does Johns Hopkins University located? | Johns Hopkins University refers to university_name = 'Johns Hopkins University'; which country refers to country_name | 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' |
university | Give the names of universities with number of students ranges from 400 to 1000. | number of students ranges from 400 to 1000 refers to num_students BETWEEN 400 AND 1000; name of university refers to university_name | 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 |
university | In what year does the Brown University score the highest? | Brown University refers to university_name = 'Brown University'; score the highest refers to MAX(score) | 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 |
university | Calculate the average score of Emory University from 2011 to 2016. | average score refers to avg(score); Emory University refers to university_name = 'Emory University'; from 2011 to 2016 refers to year BETWEEN 2011 AND 2016; | 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 |
university | Give the name of the university with the most number of students in 2015. | most number of students refers to MAX(num_students); in 2015 refers to year = 2015; name of university refers to university_name; | 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 |
university | What is the location and number of female students in university ID 23 in 2011? | in 2011 refers to year 2011; female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); location refers to country_name | 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 |
university | How many universities scored 40 in teaching criteria? | scored 40 refers to score = 40; in teaching refers to criteria_name = 'Teaching' | 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 |
university | Among the universities in United States of America, what is the percentage of female students in year 2016? | female students refers to DIVIDE(MULTIPLY(num_students, pct_female_students), 100); in United States of America refers to country_name = 'United States of America'; percentage refers to DIVIDE(SUM(DIVIDE(MULTIPLY(num_students, pct_female_students), 100)), SUM(num_students)) | 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 |
university | Calculate the difference between the total number of students and the number of international international students in Univeristy of Tokyo from 2011 to 2014. | international students refers to DIVIDE(MULTIPLY(num_students, pct_international_students), 100); difference refers to SUBTRACT(SUM(num_students), SUM(DIVIDE(MULTIPLY(num_students, pct_international_students), 100))); in University of Tokyo refers to university_name = 'University of Tokyo'; from 2011 to 2014 refers to year BETWEEN 2011 AND 2014 | 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' |
university | List the names of universities with a score less than 28% of the average score of all universities in 2015. | in 2015 refers to year = 2015; score less than 28% refers to score < MULTIPLY(avg(score), 0.28) where year = 2015; names of universities refers to university_name | 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 ) |
sales_in_weather | How many units of item no.9 were sold in store no.1 on 2012/1/1? | store no. 1 refers to store_nbr = 1; item no. 9 refers to item_nbr = 9; on 2012/1/1 refers to date = '2012-01-01' | SELECT units FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 AND item_nbr = 9 |
sales_in_weather | How many units of item no.9 were sold in store no.1 in total in January, 2012? | store no. 1 refers to store_nbr = 1; item no. 9 refers to item_nbr = 9; in January refers to SUBSTR(date, 1, 4) = '2012' and SUBSTR(date, 6, 2) = '01' | SELECT SUM(units) FROM sales_in_weather WHERE SUBSTR(`date`, 6, 2) = '01' AND SUBSTR(`date`, 1, 4) = '2012' AND item_nbr = 9 AND store_nbr = 1 |
sales_in_weather | What is the ID of the item that sold the best on 2012/1/1 in store no.1? | sold on 2012/1/1 refers to date = '2012-01-01'; in store no.1 refers to store_nbr = 1; item sold the best refers to Max(units) | SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1 |
sales_in_weather | What was the temperature range of station no.1 on 2012/1/1? | on 2012/1/1 refers to date = '2012-01-01'; temperature range refers to Subtract (tmax, tmin); station no.1 refers to station_nbr = 1 | SELECT tmax - tmin AS temrange FROM weather WHERE station_nbr = 1 AND `date` = '2012-01-01' |
sales_in_weather | Please list the dates on which the temperature of station no.2 was above the 30-year normal. | temperature above the 30-year normal refers to depart > 0; station no.2 refers to station_nbr = 2 | SELECT `date` FROM weather WHERE station_nbr = 2 AND depart > 0 |
sales_in_weather | On which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2? | station no.1 refers to station_nbr = 1; 2012/1/1 refers to date = '2012-01-01'; 2012/1/2 refers to date = '2012-01-02'; more windy refers to Max(avgspeed) | SELECT CASE WHEN (SUM(CASE WHEN `date` = '2012-01-01' THEN avgspeed ELSE 0 END) - SUM(CASE WHEN `date` = '2012-01-02' THEN avgspeed ELSE 0 END)) > 0 THEN '2012-01-01' ELSE '2012-01-02' END FROM weather WHERE station_nbr = 1 |
sales_in_weather | What is the total number of units of item no.5 sold in store no.3 in 2012 on days when the temperature was below the 30-year normal? | item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the temperature was below the 30-year normal refers to depart < 0; in 2012 refers to SUBSTR(date, 1, 4) = '2012'; total number of units refers to Sum(units) | SELECT SUM(CASE WHEN T3.depart < 0 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 SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 |
sales_in_weather | How many units of item no.5 were sold in store no.3 on the day in 2012 when the max temperature was the highest? | item no.5 refers to item_nbr = 5; store no. 3 refers to store_nbr = 3; when the max temperature was highest refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012' | SELECT T1.units 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 SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY tmax DESC LIMIT 1 |
sales_in_weather | What was the dew point on the day the most units of item no.5 were sold in store no.3 in 2012? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; in 2012 refers to SUBSTR(date, 1, 4) = '2012': most units sold refers to Max(units) | SELECT dewpoint 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 SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 ORDER BY units DESC LIMIT 1 |
sales_in_weather | On how many days with the max temperature over 90 did the sale of item no.5 in store no.3 exceed 100? | max temperature over 90 refers to tmax > 90; item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; sale exceed 100 refers to units > 100; number of days refers to count (date) | SELECT SUM(CASE WHEN units > 100 THEN 1 ELSE 0 END) AS count 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 SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.item_nbr = 5 AND tmax > 90 |
sales_in_weather | How many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; when the temperature range was the biggest refers to Max(Subtract(tmax, tmin)) | 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 |
sales_in_weather | Among the days on which over 100 units of item no.5 were sold in store no.3, on which date was the temperature range the biggest? | over 100 units refers to units > 100; item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; the temperature range was the biggest refers to Max(Subtract(tmax, tmin)) | SELECT T2.`date` 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 AND T2.units > 100 ORDER BY tmax - tmin DESC LIMIT 1 |
sales_in_weather | 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? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; with a total precipitation of over 0.05 refers to preciptotal > 0.05 | 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 |
sales_in_weather | Please list the dates on which the sale of item no.5 in store no.3 exceeded 100 and the average wind speed exceeded 10. | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; exceed 100 refers to units > 100; average wind speed exceeded 10 refers to avgspeed > 10 | SELECT T1.`date` 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 AND T1.units > 100 AND T3.avgspeed > 10 |
sales_in_weather | What is the total units of products sold on the day with the highest max temperature in store no.3 in 2012? | highest max temperature refers to Max(tmax); store no.3 refers to store_nbr = 3; in 2012 refers to substring (date, 1, 4) = '2012'; total units refers to sum(units) | SELECT SUM(units) 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.`date` LIKE '%2012%' GROUP BY T3.tmax ORDER BY T3.tmax DESC LIMIT 1 |
sales_in_weather | How many more units of item no.16 were sold on the day with the highest max temperature in 2012 in store no.5 than in store no.10? | store no. 5 refers to store_nbr = 5; store no. 10 refers to store_nbr = 10; item no.16 refers to item_nbr = 16; in 2012 refers to SUBSTR(date, 1, 4) = '2012'; highest max temperature refers to Max(tmax); more units sold refers to Subtract ( Sum(units where store_nbr = 5), Sum(units where store_nbr = 10)) | SELECT ( SELECT SUM(units) 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 T1.item_nbr = 16 AND T1.`date` LIKE '%2012%' AND T1.store_nbr = 5 GROUP BY tmax ORDER BY T3.tmax DESC LIMIT 1 ) - ( SELECT SUM(units) 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 T1.item_nbr = 16 AND T1.`date` LIKE '%2012%' AND T1.store_nbr = 6 GROUP BY tmax ORDER BY T3.tmax DESC LIMIT 1 ) |
sales_in_weather | What is the ID of the item that sold the best on the day with the highest max temperature in store no.3 in 2012? | highest max temperature refers to Max(tmax); store no.3 refers to store_nbr = 3; in 2012 refers to substring (date, 1, 4) = '2012'; sold the best refers to Max(units); ID of the item refers to item_nbr | SELECT T1.item_nbr 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 T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND tmax = ( SELECT MAX(tmax) 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 T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' ) GROUP BY T1.item_nbr ORDER BY SUM(units) DESC LIMIT 1 |
sales_in_weather | On the day with the highest max temperature in 2012, how many items in store no.3 had no sales? | highest max temperature refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012'; store no.3 refers to store_nbr = 3; had no sale refers to units = 0 | SELECT COUNT(DISTINCT T1.item_nbr) 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 AND T1.store_nbr = 3 AND SUBSTR(T1.`date`, 1, 4) = '2012' AND T1.units = 0 GROUP BY T3.tmax ORDER BY T3.tmax DESC LIMIT 1 |
sales_in_weather | How many units of item no.5 were sold in store no.3 on average on the days when the max temperature exceeded 90? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; when the maximum temperature exceed 90 refers to tmax > 90; average = Divide (Sum(units), Count(date)) | SELECT CAST(SUM(T1.units) AS REAL) / COUNT(T1.`date`) 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 T1.store_nbr = 3 AND T1.item_nbr = 5 AND T3.tmax > 90 |
sales_in_weather | What is the percentage of the units of item no.5 sold among all units of items sold in store no.3 on the day with the highest max temperature in 2012? | item no. 5 refers to item_nbr = 5; store no.3 refers to store_nbr = 3; highest max temperature refers to Max(tmax); in 2012 refers to SUBSTR(date, 1, 4) = '2012'; Percentage = Divide (Sum(units where item_nbr = 5), Sum(units)) * 100 | SELECT CAST(SUM(CASE WHEN T1.item_nbr = 5 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) 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 T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' AND T3.tmax = ( SELECT MAX(T3.tmax) 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 T1.store_nbr = 3 AND T1.`date` LIKE '%2012%' ) |
sales_in_weather | Give the id of the bestsellers of store no.1 on 2012/1/1. | store no. 1 refers to store_nbr = 1; on 2012/1/1 refers to date = '2012-01-01'; best seller refers to Max(units); ID refers to item_nbr | SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1 |
sales_in_weather | How many no.9 items from store no.11 were sold on 2012/12/7? | no. 9 item refers to item_nbr = 9; store no.11 refers to store_nbr = 11; sold on 2012/12/7 refers to date = '2012-12-07' | SELECT units FROM sales_in_weather WHERE `date` = '2012-12-07' AND store_nbr = 11 AND item_nbr = 9 |
sales_in_weather | Give the average temperature of station no.20 on 2014/10/17. | station no.20 refers to station_nbr = 20; on 2014/10/17 refers to date = '2014-10-17'; average temperature refers to tavg | SELECT tavg FROM weather WHERE `date` = '2014-10-17' AND station_nbr = 20 |
sales_in_weather | Tell the resultant wind speed of station no.9 on 2014/1/15. | station no.9 refers to station_nbr = 9; on 2014/1/15 refers to date = '2014/01/15'; result wind speed refers to resultspeed | SELECT resultspeed FROM weather WHERE `date` = '2014-01-15' AND station_nbr = 9 |
sales_in_weather | Give the id of the weather station with most stores. | station with more stores refers to Max(Count(store_nbr)); ID of weather station refers to station_nbr | SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(station_nbr) DESC LIMIT 1 |
sales_in_weather | Which weather station does store no.20 belong to? | store no.20 refers to store_nbr = 20; weather station refers to station_nbr | SELECT station_nbr FROM relation WHERE store_nbr = 20 |
sales_in_weather | Tell the temperature range of the home weather station of store no.7 on 2014/4/28. | store no.7 refers to tore_nbr = 7; on 2014/4/28 refers to date = '2014-04-28'; temperature range refers to Subtract (tmax, tmin) | SELECT T1.tmax - T1.tmin AS temprange FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 7 AND T1.`date` = '2014-04-28' |
sales_in_weather | For the weather station which recorded the highest temperature above the 30-year normal, how many stores does it have? | highest temperature above the 30-year normal refers to Max(depart) | SELECT store_nbr FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY depart DESC LIMIT 1 ) |
sales_in_weather | For the home weather station of store no.15, what was the dew point on 2012/2/18? | store no. 15 refers to store_nbr = 15; on 2012/2/18 refers to date = '2012-02-18' | SELECT T1.dewpoint FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 15 AND T1.`date` = '2012-02-18' |
sales_in_weather | Tell the wet-bulb temperature of the weather station which contained store no.6 on 2012/2/15. | store no.6 refers to store_nbr = 6; on 2012/2/15 refers to date = '2012-02-15'; wet-bulb temperature refers to wetbulb | SELECT T1.wetbulb FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 14 AND T1.`date` = '2012-02-15' |
sales_in_weather | Give the number of stores which opened on the weather station that recorded the fastest average wind speed. | fastest average wind speed refers to Max(avgspeed); number of store refers to count(store_nbr) | 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 |
sales_in_weather | State the max temperature of the weather station which has the no.21 store on 2012/11/9. | no.21 store refers to store_nbr = 21; on 2012/11/9 refers to date = '2012-11-09'; max temperature refers to tmax | SELECT tmax FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 21 AND T1.`date` = '2012-11-09' |
sales_in_weather | Provide the sunrise time recorded by the home weather station of store no.30 on 2014/2/21. | store no. 30 refers to store_nbr = 30; on 2014/2/21 refers to date = '2014-02-21' | SELECT T1.sunrise FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2014-02-21' AND store_nbr = 30 |
sales_in_weather | State the number of stores that belongs to the weather station which recorded the deepest snowfall. | deepest snowfall refers to Max(snowfall); number of stores refers to store_nbr | 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 |
sales_in_weather | Provide the code summarization for the weather recorded by the weather station which contained the no.2 store on 2013/2/12. | no.2 store refers to store_nbr = 2; on 2013/2/12 refers to date = '2013-02-12'; code summarization refers to codesum | SELECT T1.codesum FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2013-02-12' AND T2.store_nbr = 2 |
sales_in_weather | Show the sea level status recorded by the weather station of store no.19 on 2013/2/24. | store no.19 refers to store_nbr = 19; on 2013/2/24 refers to date = '2013-02-24'; sea level status refers to sealevel | SELECT T1.sealevel FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2013-02-24' AND T2.store_nbr = 19 |
sales_in_weather | How many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25? | store no.2 refers to store_nbr = 2; on 2012/12/25 refers to date = '2012-12-25'; total precipitation refers to preciptotal | SELECT T1.preciptotal FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2012-12-25' AND T2.store_nbr = 2 |
sales_in_weather | Give the station pressure status recorded by the weather station which contained no.12 store on 2012/5/15. | no.12 store refers to store_nbr = 12; on 2012/5/15 refers to date = '2012-05-15'; station pressure status refers to stnpressure | SELECT T1.stnpressure FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.`date` = '2012-05-15' AND T2.store_nbr = 12 |
sales_in_weather | What percentage was the total unit sales of store no.10 to the total sales of its weather station on 2014/10/31? | store no.10 refers to store_nbr = 10; on 2014/10/31 refers to date = '2014-10-31'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100 | SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.`date` = '2014-10-31' |
sales_in_weather | For the weather station has store no.9, what was the increased percentage of the average temperature from 2012/2/2 to 2012/2/3? | store no.9 refers to store_nbr = 9; 2012/2/2 refers to date = '2012-02-02'; 2012/2/3 refers to date = '2012-02-03'; average temperature refers to tavg; increase percentage = Divide (Subtract (tavg where date = '2012-02-03', tavg where date = '2012-02-02'), tavg where date = '2012-02-02') * 100 | SELECT CAST((SUM(CASE WHEN T1.`date` = '2012-02-03' THEN T1.tavg * 1 ELSE 0 END) - SUM(CASE WHEN T1.`date` = '2012-02-02' THEN T1.tavg * 1 ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T1.`date` = '2012-02-02' THEN T1.tavg * 1 ELSE 0 END) FROM weather AS T1 INNER JOIN relation AS T2 ON T1.station_nbr = T2.station_nbr WHERE T2.store_nbr = 9 |
sales_in_weather | What is the item number of the product with the highest number of units sold in store number 1 on 1/1/2012? | item number refers to item_nbr; highest number of units sold refers to Max(units); store no.1 refers to store_nbr = 1; on 1/1/2012 refers to date = '2012-01-01' | SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1 |
sales_in_weather | How many stores are in weather station 12? | weather station 12 refers to station_nbr = 12; number of stores refers to Count(store_nbr) | SELECT SUM(store_nbr) FROM relation WHERE station_nbr = 12 |
sales_in_weather | How many items weren't sold in store 2 on 1/1/2012? | store no.2 refers to store_nbr = 2; item weren't sold refers to units = 0; on 1/1/2012 refers to date = '2012-01-01' | SELECT COUNT(item_nbr) FROM sales_in_weather WHERE store_nbr = 2 AND units = 0 AND `date` = '2012-01-01' |
sales_in_weather | Between 1/1/2012 to 12/31/2014, which date recorded the hottest temperature in weather station 1? | weather station 1 refers to station_nbr = 1; hottest temperature refers to Max(tmax); between 1/1/2012 to 12/31/2014 refers to SUBSTR(date, 1, 4) between 2012 and 2014 | SELECT `date` FROM weather WHERE station_nbr = 1 AND CAST(SUBSTR(`date`, 1, 4) AS int) BETWEEN 2012 AND 2014 ORDER BY tmax DESC LIMIT 1 |
sales_in_weather | Which weather station has the highest number of stores? | number of store refers to store_nbr; highest number of store refers to Max(Count(store_nbr)); weather station refers to station_nbr | SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1 |
sales_in_weather | In March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal? | in March 2014 refers to substring (date, 1, 4) = '2014' and substring (date, 6, 2) = '03'; temperature is below the 30-year normal refers to depart < 0; highest number of days refers to Max(Count(date)) | SELECT station_nbr FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr HAVING COUNT(DISTINCT `date`) = ( SELECT COUNT(DISTINCT `date`) FROM weather WHERE SUBSTR(`date`, 1, 4) = '2014' AND SUBSTR(`date`, 6, 2) = '03' AND depart < 0 GROUP BY station_nbr ORDER BY COUNT(`date`) DESC LIMIT 1 ) |
sales_in_weather | Which weather station does the store that sold the highest quantity of item 9 belongs to? | item 9 refers to item_nbr = 9; sold the highest quantity refers to Max(Sum(units)); weather station refers to station_nbr | 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 |
sales_in_weather | How many stores belong to the most windy station? | most windy station refers to Max(avgspeed) | SELECT COUNT(store_nbr) FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 ) |
sales_in_weather | Among the stores in weather station 14 in February 2014, which store had sold no less than 300 quantities for item number 44 in a single day? | weather station 14 refers to station_nbr = 14; February 2014 refers to substring (date, 1, 7) = '2014-02' ; sold no less than 300 quantities refers to units > = 300; item no.44 refers to item_nbr = 44; store refers to store_nbr | SELECT T1.store_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T2.station_nbr = 14 AND T1.`date` LIKE '%2014-02%' AND T1.item_nbr = 44 AND units >= 300 |
sales_in_weather | What is the most purchased products during the rainy days in June 2013 in weather station 9? | most purchased product refers to Max(units); during the rainy day refers to codesum = RA; in June 2013 refers to SUBSTR(date, 1, 7) = '2013-06'; weather station 9 refers to station_nbr = 9; product refers to item_nbr | SELECT T1.item_nbr 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 T3.station_nbr = 9 AND T1.`date` LIKE '%2013-06%' AND codesum = 'RA' ORDER BY T1.units DESC LIMIT 1 |
sales_in_weather | Which station sold the highest quantity of item number 5 overall? | item number 5 refers to item_nbr = 5; sold highest quantity refers to Max(Sum(units)); station refers to station_nbr | 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 |
sales_in_weather | What is the earliest sunrise recorded in the stations with no more than 1 store in February 2012? | in February 2012 refers to SUBSTR(date, 1, 7) = '2012-02'; earliest sunrise Min(sunrise); station with no more than 1 store refers to station_nbr where Count(store_nbr) = 1 | SELECT T1.station_nbr FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE sunrise IS NOT NULL AND T2.`date` LIKE '%2012-02%' AND T1.station_nbr IN ( SELECT station_nbr FROM relation GROUP BY station_nbr HAVING COUNT(store_nbr) = 1 ) ORDER BY sunrise LIMIT 1 |
sales_in_weather | In weather station 17, which store sold the highest quantity of item 45 in October 2012? | weather station 17 refers to station_nbr = 17; item 45 refers to item_nbr = 45; in October 2012 refers to SUBSTR(date, 1, 7) = '2012-10': highest quantity refers to Max(Sum(units)); store refers to store_nbr | SELECT T1.store_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr WHERE T1.item_nbr = 45 AND T2.station_nbr = 17 AND T1.`date` LIKE '%2012-10%' GROUP BY T1.store_nbr ORDER BY SUM(T1.units) DESC LIMIT 1 |
sales_in_weather | What are the items sold by the store during the day whose station recorded the thickest snowfall? | thickest snowfall refers to Max(snowfall); item refers to item_nbr | SELECT T1.item_nbr FROM sales_in_weather AS T1 INNER JOIN relation AS T2 ON T1.store_nbr = T2.store_nbr INNER JOIN ( SELECT station_nbr, `date` FROM weather ORDER BY snowfall DESC LIMIT 1 ) AS T3 ON T2.station_nbr = T3.station_nbr |
sales_in_weather | What are the top 3 stations that have sold the highest quantities for an item in a single day? | highest quantity refers to Max(units); station refers to station_nbr | 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 |
sales_in_weather | How many stores belong to the station with the highest recorded heat of all time? | highest recorded heat refers to Max(heat); station refers to station_nbr | 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 |
sales_in_weather | On February 8, 2014, what is the minimum temperature in the station where store 29 belongs? | On February 8, 2014 refers to date = '2014-02-08'; store 29 refers to store_nbr = 29; minimum temperature refers to tmin; station refers to station_nbr | SELECT tmin FROM relation AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE T1.store_nbr = 29 AND T2.`date` = '2014-02-08' |
sales_in_weather | Among the stations with 3 stores, how many stations have a station pressure of no more than 30 on February 18, 2014? | station with 3 stores refers to station_nbr where Count(store_nbr) = 3; station pressure of no more than 30 refers to stnpressure < 30; On February 18, 2014 refers to date = '2014-02-18' | SELECT COUNT(station_nbr) FROM weather WHERE `date` = '2014-02-18' AND stnpressure < 30 AND station_nbr IN ( SELECT station_nbr FROM relation GROUP BY station_nbr HAVING COUNT(store_nbr) = 3 ) |
sales_in_weather | Which station has the highest number of stores? Calculate the said station's average maximum temperature in February 2012. | station with highest number of stores refers to station_nbr where Max(Count(store_nbr)); station refers to station_nbr; in February 2012 refers to substring (date, 1, 7) = '2012-02'; average maximum temperature = Divide(Sum(tmax), 29) | SELECT CAST(SUM(T2.tmax) AS REAL) / 29 FROM ( SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1 ) AS T1 INNER JOIN weather AS T2 ON T1.station_nbr = T2.station_nbr WHERE SUBSTR(T2.`date`, 1, 7) = '2012-02' |
sales_in_weather | Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014? | weather station 12 refers to station_nbr = 12; item 5 refers to item_nbr = 5; 10 store refers to store_nbr = 10; in 2014 refers to SUBSTR(date, 1, 4) = '2014'; percentage = Divide (Sum(units where store_nbr = 10), Sum(units)) * 100 | SELECT CAST(SUM(CASE WHEN T2.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / SUM(units) FROM relation AS T1 INNER JOIN sales_in_weather AS T2 ON T1.store_nbr = T2.store_nbr WHERE station_nbr = 12 AND item_nbr = 5 AND T2.`date` LIKE '%2014%' |
sales_in_weather | What is the maximum average speed? | maximum average speed refers to Max(avgspeed) | SELECT MAX(avgspeed) FROM weather |
sales_in_weather | How many days did the show fell more than 5 inches? | snow fell more than 5 inches refers to snowfall > 5 | SELECT COUNT(DISTINCT `date`) FROM weather WHERE snowfall > 5 |
sales_in_weather | How many days did the sun rise before 5 AM? | sunrise before 5 Am refers to sunrise < time ('5:00:00') | SELECT COUNT(DISTINCT `date`) AS days FROM weather WHERE sunrise < time('05:00:00') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.