1sf/bird-sql-train-with-schema huggingface dataset:
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25?
Evidence: store no.2 refers to store_nbr = 2; on 2012/12/25 refers to date = '2012-12-25'; total precipitation refers to preciptotal
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Give the station pressure status recorded by the weather station which contained no.12 store on 2012/5/15.
Evidence: no.12 store refers to store_nbr = 12; on 2012/5/15 refers to date = '2012-05-15'; station pressure status refers to stnpressure
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What percentage was the total unit sales of store no.10 to the total sales of its weather station on 2014/10/31?
Evidence: 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
SQL: 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'
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
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?
Evidence: 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
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the item number of the product with the highest number of units sold in store number 1 on 1/1/2012?
Evidence: 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'
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
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many stores are in weather station 12?
Evidence: weather station 12 refers to station_nbr = 12; number of stores refers to Count(store_nbr)
SQL: SELECT SUM(store_nbr) FROM relation WHERE station_nbr = 12
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many items weren't sold in store 2 on 1/1/2012?
Evidence: 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'
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
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Between 1/1/2012 to 12/31/2014, which date recorded the hottest temperature in weather station 1?
Evidence: 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
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
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Which weather station has the highest number of stores?
Evidence: number of store refers to store_nbr; highest number of store refers to Max(Count(store_nbr)); weather station refers to station_nbr
SQL: SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: In March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?
Evidence: 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))
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
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Which weather station does the store that sold the highest quantity of item 9 belongs to?
Evidence: item 9 refers to item_nbr = 9; sold the highest quantity refers to Max(Sum(units)); weather station refers to station_nbr
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many stores belong to the most windy station?
Evidence: most windy station refers to Max(avgspeed)
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
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_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?
Evidence: 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
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the most purchased products during the rainy days in June 2013 in weather station 9?
Evidence: 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
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Which station sold the highest quantity of item number 5 overall?
Evidence: item number 5 refers to item_nbr = 5; sold highest quantity refers to Max(Sum(units)); station refers to station_nbr
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the earliest sunrise recorded in the stations with no more than 1 store in February 2012?
Evidence: 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
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: In weather station 17, which store sold the highest quantity of item 45 in October 2012?
Evidence: 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
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What are the items sold by the store during the day whose station recorded the thickest snowfall?
Evidence: thickest snowfall refers to Max(snowfall); item refers to item_nbr
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What are the top 3 stations that have sold the highest quantities for an item in a single day?
Evidence: highest quantity refers to Max(units); station refers to station_nbr
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many stores belong to the station with the highest recorded heat of all time?
Evidence: highest recorded heat refers to Max(heat); station refers to station_nbr
SQL: 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
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: On February 8, 2014, what is the minimum temperature in the station where store 29 belongs?
Evidence: 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
SQL: 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'
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Among the stations with 3 stores, how many stations have a station pressure of no more than 30 on February 18, 2014?
Evidence: 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'
SQL: 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 )
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Which station has the highest number of stores? Calculate the said station's average maximum temperature in February 2012.
Evidence: 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)
SQL: 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'
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?
Evidence: 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
SQL: 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%'
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the maximum average speed?
Evidence: maximum average speed refers to Max(avgspeed)
SQL: SELECT MAX(avgspeed) FROM weather
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many days did the show fell more than 5 inches?
Evidence: snow fell more than 5 inches refers to snowfall > 5
SQL: SELECT COUNT(DISTINCT `date`) FROM weather WHERE snowfall > 5
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: How many days did the sun rise before 5 AM?
Evidence: sunrise before 5 Am refers to sunrise < time ('5:00:00')
SQL: SELECT COUNT(DISTINCT `date`) AS days FROM weather WHERE sunrise < time('05:00:00')
Database: sales_in_weather
Tables: sales_in_weather, weather, relation
Columns (table index, column name): -1, *, 0, date, 0, store_nbr, 0, item_nbr, 0, units, 1, station_nbr, 1, date, 1, tmax, 1, tmin, 1, tavg, 1, depart, 1, dewpoint, 1, wetbulb, 1, heat, 1, cool, 1, sunrise, 1, sunset, 1, codesum, 1, snowfall, 1, preciptotal, 1, stnpressure, 1, sealevel, 1, resultspeed, 1, resultdir, 1, avgspeed, 2, store_nbr, 2, station_nbr
Question: What is the minimum dew point?
Evidence: minimum dew point refers to Min(dewpoint)
SQL: SELECT MIN(dewpoint) FROM weather