Chinastark/bird_dataset huggingface dataset:
Database: sales_in_weather
Note: 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;
Question: What was the temperature range of station no.1 on 2012/1/1?
SQL: SELECT tmax - tmin AS temrange FROM weather WHERE station_nbr = 1 AND `date` = '2012-01-01'
Database: sales_in_weather
Note: temperature above the 30-year normal refers to depart > 0; station no.2 refers to station_nbr = 2;
Question: Please list the dates on which the temperature of station no.2 was above the 30-year normal.
SQL: SELECT `date` FROM weather WHERE station_nbr = 2 AND depart > 0
Database: sales_in_weather
Note: 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);
Question: On which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2?
SQL: 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
Database: sales_in_weather
Note: 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);
Question: 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?
SQL: SELECT sum(CASE WHEN weather.depart < 0 THEN units ELSE 0 END) AS SUM FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND substr(sales_in_weather.`date`, 1, 4) = '2012' AND sales_in_weather.item_nbr = 5
Database: sales_in_weather
Note: 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';
Question: 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?
SQL: SELECT sales_in_weather.units FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND substr(sales_in_weather.`date`, 1, 4) = '2012' AND sales_in_weather.item_nbr = 5 ORDER BY tmax DESC LIMIT 1
Database: sales_in_weather
Note: 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);
Question: What was the dew point on the day the most units of item no.5 were sold in store no.3 in 2012?
SQL: SELECT dewpoint FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND substr(sales_in_weather.`date`, 1, 4) = '2012' AND sales_in_weather.item_nbr = 5 ORDER BY units DESC LIMIT 1
Database: sales_in_weather
Note: 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);
Question: On how many days with the max temperature over 90 did the sale of item no.5 in store no.3 exceed 100?
SQL: SELECT sum(CASE WHEN units > 100 THEN 1 ELSE 0 END) AS COUNT FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND substr(sales_in_weather.`date`, 1, 4) = '2012' AND sales_in_weather.item_nbr = 5 AND tmax > 90
Database: sales_in_weather
Note: 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));
Question: How many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest?
SQL: SELECT sales_in_weather.units FROM relation INNER JOIN sales_in_weather ON relation.store_nbr = sales_in_weather.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.item_nbr = 5 ORDER BY weather.tmax - weather.tmin DESC LIMIT 1
Database: sales_in_weather
Note: 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));
Question: 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?
SQL: SELECT sales_in_weather.`date` FROM relation INNER JOIN sales_in_weather ON relation.store_nbr = sales_in_weather.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.item_nbr = 5 AND sales_in_weather.units > 100 ORDER BY tmax - tmin DESC LIMIT 1
Database: sales_in_weather
Note: 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;
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?
SQL: SELECT sum(CASE WHEN weather.preciptotal > 0.05 THEN units ELSE 0 END) AS SUM FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND sales_in_weather.item_nbr = 5
Database: sales_in_weather
Note: 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;
Question: 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.
SQL: SELECT sales_in_weather.`date` FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND sales_in_weather.item_nbr = 5 AND sales_in_weather.units > 100 AND weather.avgspeed > 10
Database: sales_in_weather
Note: 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);
Question: What is the total units of products sold on the day with the highest max temperature in store no.3 in 2012?
SQL: SELECT sum(units) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE relation.store_nbr = 3 AND sales_in_weather.`date` LIKE '%2012%' GROUP BY weather.tmax ORDER BY weather.tmax DESC LIMIT 1
Database: sales_in_weather
Note: 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));
Question: 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?
SQL: SELECT ( SELECT sum(units) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.item_nbr = 16 AND sales_in_weather.`date` LIKE '%2012%' AND sales_in_weather.store_nbr = 5 GROUP BY tmax ORDER BY weather.tmax DESC LIMIT 1 ) - ( SELECT sum(units) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.item_nbr = 16 AND sales_in_weather.`date` LIKE '%2012%' AND sales_in_weather.store_nbr = 6 GROUP BY tmax ORDER BY weather.tmax DESC LIMIT 1 )
Database: sales_in_weather
Note: 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;
Question: 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?
SQL: SELECT sales_in_weather.item_nbr FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.`date` LIKE '%2012%' AND tmax = ( SELECT max(tmax) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.`date` LIKE '%2012%' ) GROUP BY sales_in_weather.item_nbr ORDER BY sum(units) DESC LIMIT 1
Database: sales_in_weather
Note: 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;
Question: On the day with the highest max temperature in 2012, how many items in store no.3 had no sales?
SQL: SELECT count(DISTINCT sales_in_weather.item_nbr) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr AND sales_in_weather.store_nbr = 3 AND substr(sales_in_weather.`date`, 1, 4) = '2012' AND sales_in_weather.units = 0 GROUP BY weather.tmax ORDER BY weather.tmax DESC LIMIT 1
Database: sales_in_weather
Note: 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));
Question: How many units of item no.5 were sold in store no.3 on average on the days when the max temperature exceeded 90?
SQL: SELECT cast(sum(sales_in_weather.units) AS REAL) / count(sales_in_weather.`date`) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.item_nbr = 5 AND weather.tmax > 90
Database: sales_in_weather
Note: 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;
Question: 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?
SQL: SELECT cast(sum(CASE WHEN sales_in_weather.item_nbr = 5 THEN units * 1 ELSE 0 END) AS REAL) * 100 / sum(units) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.`date` LIKE '%2012%' AND weather.tmax = ( SELECT max(weather.tmax) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE sales_in_weather.store_nbr = 3 AND sales_in_weather.`date` LIKE '%2012%' )
Database: sales_in_weather
Note: 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;
Question: Give the id of the bestsellers of store no.1 on 2012/1/1.
SQL: SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1
Database: sales_in_weather
Note: 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';
Question: How many no.9 items from store no.11 were sold on 2012/12/7?
SQL: SELECT units FROM sales_in_weather WHERE `date` = '2012-12-07' AND store_nbr = 11 AND item_nbr = 9
Database: sales_in_weather
Note: station no.20 refers to station_nbr = 20; on 2014/10/17 refers to date = '2014-10-17'; average temperature refers to tavg;
Question: Give the average temperature of station no.20 on 2014/10/17.
SQL: SELECT tavg FROM weather WHERE `date` = '2014-10-17' AND station_nbr = 20
Database: sales_in_weather
Note: station no.9 refers to station_nbr = 9; on 2014/1/15 refers to date = '2014/01/15'; result wind speed refers to resultspeed;
Question: Tell the resultant wind speed of station no.9 on 2014/1/15.
SQL: SELECT resultspeed FROM weather WHERE `date` = '2014-01-15' AND station_nbr = 9
Database: sales_in_weather
Note: station with more stores refers to Max(Count(store_nbr)); ID of weather station refers to station_nbr;
Question: Give the id of the weather station with most stores.
SQL: SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY count(station_nbr) DESC LIMIT 1
Database: sales_in_weather
Note: store no.20 refers to store_nbr = 20; weather station refers to station_nbr;
Question: Which weather station does store no.20 belong to?
SQL: SELECT station_nbr FROM relation WHERE store_nbr = 20
Database: sales_in_weather
Note: 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);
Question: Tell the temperature range of the home weather station of store no.7 on 2014/4/28.
SQL: SELECT weather.tmax - weather.tmin AS temprange FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE relation.store_nbr = 7 AND weather.`date` = '2014-04-28'
Database: sales_in_weather
Note: highest temperature above the 30-year normal refers to Max(depart);
Question: For the weather station which recorded the highest temperature above the 30-year normal, how many stores does it have?
SQL: SELECT store_nbr FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY depart DESC LIMIT 1 )
Database: sales_in_weather
Note: store no. 15 refers to store_nbr = 15; on 2012/2/18 refers to date = '2012-02-18';
Question: For the home weather station of store no.15, what was the dew point on 2012/2/18?
SQL: SELECT weather.dewpoint FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE relation.store_nbr = 15 AND weather.`date` = '2012-02-18'
Database: sales_in_weather
Note: store no.6 refers to store_nbr = 6; on 2012/2/15 refers to date = '2012-02-15'; wet-bulb temperature refers to wetbulb;
Question: Tell the wet-bulb temperature of the weather station which contained store no.6 on 2012/2/15.
SQL: SELECT weather.wetbulb FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE relation.store_nbr = 14 AND weather.`date` = '2012-02-15'
Database: sales_in_weather
Note: fastest average wind speed refers to Max(avgspeed); number of store refers to count(store_nbr);
Question: Give the number of stores which opened on the weather station that recorded the fastest average wind speed.
SQL: 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
Database: sales_in_weather
Note: no.21 store refers to store_nbr = 21; on 2012/11/9 refers to date = '2012-11-09'; max temperature refers to tmax;
Question: State the max temperature of the weather station which has the no.21 store on 2012/11/9.
SQL: SELECT tmax FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE relation.store_nbr = 21 AND weather.`date` = '2012-11-09'
Database: sales_in_weather
Note: store no. 30 refers to store_nbr = 30; on 2014/2/21 refers to date = '2014-02-21';
Question: Provide the sunrise time recorded by the home weather station of store no.30 on 2014/2/21.
SQL: SELECT weather.sunrise FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE weather.`date` = '2014-02-21' AND store_nbr = 30
Database: sales_in_weather
Note: deepest snowfall refers to Max(snowfall); number of stores refers to store_nbr;
Question: State the number of stores that belongs to the weather station which recorded the deepest snowfall.
SQL: SELECT relation.store_nbr FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr ORDER BY snowfall DESC LIMIT 1
Database: sales_in_weather
Note: no.2 store refers to store_nbr = 2; on 2013/2/12 refers to date = '2013-02-12'; code summarization refers to codesum;
Question: Provide the code summarization for the weather recorded by the weather station which contained the no.2 store on 2013/2/12.
SQL: SELECT weather.codesum FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE weather.`date` = '2013-02-12' AND relation.store_nbr = 2
Database: sales_in_weather
Note: store no.19 refers to store_nbr = 19; on 2013/2/24 refers to date = '2013-02-24'; sea level status refers to sealevel;
Question: Show the sea level status recorded by the weather station of store no.19 on 2013/2/24.
SQL: SELECT weather.sealevel FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE weather.`date` = '2013-02-24' AND relation.store_nbr = 19
Database: sales_in_weather
Note: store no.2 refers to store_nbr = 2; on 2012/12/25 refers to date = '2012-12-25'; total precipitation refers to preciptotal;
Question: How many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25?
SQL: SELECT weather.preciptotal FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE weather.`date` = '2012-12-25' AND relation.store_nbr = 2
Database: sales_in_weather
Note: no.12 store refers to store_nbr = 12; on 2012/5/15 refers to date = '2012-05-15'; station pressure status refers to stnpressure;
Question: Give the station pressure status recorded by the weather station which contained no.12 store on 2012/5/15.
SQL: SELECT weather.stnpressure FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE weather.`date` = '2012-05-15' AND relation.store_nbr = 12
Database: sales_in_weather
Note: 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;
Question: What percentage was the total unit sales of store no.10 to the total sales of its weather station on 2014/10/31?
SQL: SELECT cast(sum(CASE WHEN relation.store_nbr = 10 THEN units * 1 ELSE 0 END) AS REAL) * 100 / sum(units) FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr WHERE sales_in_weather.`date` = '2014-10-31'
Database: sales_in_weather
Note: 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;
Question: 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?
SQL: SELECT cast((sum(CASE WHEN weather.`date` = '2012-02-03' THEN weather.tavg * 1 ELSE 0 END) - sum(CASE WHEN weather.`date` = '2012-02-02' THEN weather.tavg * 1 ELSE 0 END)) AS REAL) * 100 / sum(CASE WHEN weather.`date` = '2012-02-02' THEN weather.tavg * 1 ELSE 0 END) FROM weather INNER JOIN relation ON weather.station_nbr = relation.station_nbr WHERE relation.store_nbr = 9
Database: sales_in_weather
Note: 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';
Question: What is the item number of the product with the highest number of units sold in store number 1 on 1/1/2012?
SQL: SELECT item_nbr FROM sales_in_weather WHERE `date` = '2012-01-01' AND store_nbr = 1 ORDER BY units DESC LIMIT 1
Database: sales_in_weather
Note: weather station 12 refers to station_nbr = 12; number of stores refers to Count(store_nbr);
Question: How many stores are in weather station 12?
SQL: SELECT sum(store_nbr) FROM relation WHERE station_nbr = 12
Database: sales_in_weather
Note: 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';
Question: How many items weren't sold in store 2 on 1/1/2012?
SQL: SELECT count(item_nbr) FROM sales_in_weather WHERE store_nbr = 2 AND units = 0 AND `date` = '2012-01-01'
Database: sales_in_weather
Note: 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;
Question: Between 1/1/2012 to 12/31/2014, which date recorded the hottest temperature in weather station 1?
SQL: 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
Database: sales_in_weather
Note: number of store refers to store_nbr; highest number of store refers to Max(Count(store_nbr)); weather station refers to station_nbr;
Question: Which weather station has the highest number of stores?
SQL: SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY count(store_nbr) DESC LIMIT 1
Database: sales_in_weather
Note: 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));
Question: In March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?
SQL: 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 )
Database: sales_in_weather
Note: item 9 refers to item_nbr = 9; sold the highest quantity refers to Max(Sum(units)); weather station refers to station_nbr;
Question: Which weather station does the store that sold the highest quantity of item 9 belongs to?
SQL: SELECT station_nbr FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr WHERE sales_in_weather.item_nbr = 9 GROUP BY relation.station_nbr ORDER BY sum(sales_in_weather.units) DESC LIMIT 1
Database: sales_in_weather
Note: most windy station refers to Max(avgspeed);
Question: How many stores belong to the most windy station?
SQL: SELECT count(store_nbr) FROM relation WHERE station_nbr = ( SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1 )
Database: sales_in_weather
Note: 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;
Question: 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?
SQL: SELECT sales_in_weather.store_nbr FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr WHERE relation.station_nbr = 14 AND sales_in_weather.`date` LIKE '%2014-02%' AND sales_in_weather.item_nbr = 44 AND units >= 300
Database: sales_in_weather
Note: 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;
Question: What is the most purchased products during the rainy days in June 2013 in weather station 9?
SQL: SELECT sales_in_weather.item_nbr FROM sales_in_weather INNER JOIN relation ON sales_in_weather.store_nbr = relation.store_nbr INNER JOIN weather ON relation.station_nbr = weather.station_nbr WHERE weather.station_nbr = 9 AND sales_in_weather.`date` LIKE '%2013-06%' AND codesum = 'RA' ORDER BY sales_in_weather.units DESC LIMIT 1