question_id
int64
1
75.7k
db_id
stringclasses
33 values
db_name
stringclasses
4 values
question
stringlengths
19
259
partition
stringclasses
4 values
difficulty
stringclasses
3 values
SQL
stringlengths
25
862
701
retails
bird
Among all the suppliers providing the part "hot spring dodger dim light", how many of them are in Europe?
train
hard
SELECT COUNT(t1.r_regionkey) FROM region AS t1 INNER JOIN nation AS t2 ON t1.r_regionkey = t2.n_regionkey INNER JOIN supplier AS t3 ON t2.n_nationkey = t3.s_nationkey WHERE t1.r_name = 'europe'
702
retails
bird
Please list the phone numbers of all the suppliers for the parts ordered in order no.1.
train
hard
SELECT t2.s_phone FROM lineitem AS t1 INNER JOIN supplier AS t2 ON t1.l_suppkey = t2.s_suppkey WHERE t1.l_orderkey = 1
703
retails
bird
Among the suppliers for the parts ordered in order no.4, how many of them are in debt?
train
hard
SELECT COUNT(t1.l_linenumber) FROM lineitem AS t1 INNER JOIN supplier AS t2 ON t1.l_suppkey = t2.s_suppkey WHERE t1.l_orderkey = 4 AND t2.s_acctbal < 0
704
retails
bird
Among the parts that are returned, how many of them are provided by a supplier in debt?
train
hard
SELECT COUNT(t1.l_partkey) FROM lineitem AS t1 INNER JOIN supplier AS t2 ON t1.l_suppkey = t2.s_suppkey WHERE t1.l_returnflag = 'r' AND t2.s_acctbal < 0
705
retails
bird
On which date was the part "burnished seashell gainsboro navajo chocolate" in order no.1 shipped?
train
hard
SELECT t1.l_shipdate FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t1.l_orderkey = 1 AND t2.p_name = 'burnished seashell gainsboro navajo chocolate'
706
retails
bird
What is the quantity of the part "burnished seashell gainsboro navajo chocolate" ordered in order no.1?
train
hard
SELECT t1.l_quantity FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t1.l_orderkey = 1 AND t2.p_name = 'burnished seashell gainsboro navajo chocolate'
707
retails
bird
Which part is ordered in a bigger amount in order no.1, "burnished seashell gainsboro navajo chocolate" or "salmon white grey tan navy"?
train
hard
SELECT t.p_name FROM (SELECT t2.p_name, SUM(t1.l_quantity) AS num FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t2.p_name IN ('salmon white grey tan navy', 'burnished seashell gainsboro navajo chocolate') GROUP BY t1.l_partkey) AS t ORDER BY t.num DESC LIMIT 1
708
retails
bird
What is the biggest discount among all orders for the part "burnished seashell gainsboro navajo chocolate"?
train
hard
SELECT MAX(t1.l_discount) FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t2.p_name = 'burnished seashell gainsboro navajo chocolate'
709
retails
bird
Please list all the modes of shipping for the part "burnished seashell gainsboro navajo chocolate".
train
hard
SELECT DISTINCT t1.l_shipmode FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t2.p_name = 'burnished seashell gainsboro navajo chocolate'
710
retails
bird
What is the average supply cost for the part "hot spring dodger dim light"?
train
hard
SELECT AVG(t1.ps_supplycost) FROM partsupp AS t1 INNER JOIN supplier AS t2 ON t1.ps_suppkey = t2.s_suppkey INNER JOIN part AS t3 ON t1.ps_partkey = t3.p_partkey WHERE t3.p_name = 'hot spring dodger dim light'
711
retails
bird
How much higher in percentage is the highest supply cost of the part "hot spring dodger dim light" than the lowest supply cost?
train
hard
SELECT CAST(CAST((MAX(t1.ps_supplycost) - MIN(t1.ps_supplycost)) AS REAL) * 100 AS REAL) / MIN(t1.ps_supplycost) FROM partsupp AS t1 INNER JOIN supplier AS t2 ON t1.ps_suppkey = t2.s_suppkey INNER JOIN part AS t3 ON t1.ps_partkey = t3.p_partkey WHERE t3.p_name = 'hot spring dodger dim light'
712
retails
bird
What is the profit for part no.98768 in order no.1?
train
hard
SELECT t1.l_extendedprice * (1 - t1.l_discount) - t2.ps_supplycost * t1.l_quantity FROM lineitem AS t1 INNER JOIN partsupp AS t2 ON t1.l_suppkey = t2.ps_suppkey WHERE t1.l_orderkey = 1 AND t1.l_partkey = 98768
713
retails
bird
What is the discounted price of the part "burnished seashell gainsboro navajo chocolate" in order no.1?
train
hard
SELECT t1.l_extendedprice * (1 - t1.l_discount) FROM lineitem AS t1 INNER JOIN part AS t2 ON t1.l_partkey = t2.p_partkey WHERE t2.p_name = 'burnished seashell gainsboro navajo chocolate' AND t1.l_orderkey = 1
714
retails
bird
Which market segment does the customer with the highest amount of debt belongs to?
train
easy
SELECT c_mktsegment FROM customer WHERE c_acctbal = (SELECT MIN(c_acctbal) FROM customer)
715
retails
bird
In 1997, how many orders were shipped via mail?
train
medium
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%y', l_shipdate) = '1997' AND l_shipmode = 'mail'
716
retails
bird
How many customers are in the furniture segment?
train
easy
SELECT COUNT(c_custkey) FROM customer WHERE c_mktsegment = 'furniture'
717
retails
bird
Among the items shipped in 1994 via truck, how many items were returned?
train
medium
SELECT COUNT(l_orderkey) FROM lineitem WHERE STRFTIME('%y', l_shipdate) = '1994' AND l_returnflag = 'r' AND l_shipmode = 'truck'
718
retails
bird
How many customers in the machinery segment are in debt?
train
medium
SELECT COUNT(c_custkey) FROM customer WHERE c_acctbal < 0 AND c_mktsegment = 'machinery'
719
retails
bird
How many urgent orders did Clerk#000000001 handle in 1997?
train
medium
SELECT COUNT(o_orderkey) FROM orders WHERE STRFTIME('%y', o_orderdate) = '1997' AND o_clerk = 'clerk#000000001' AND o_orderpriority = '1-urgent'
720
retails
bird
What is the name of the customer whose order was delivered the longest?
train
hard
SELECT t3.c_name FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey INNER JOIN customer AS t3 ON t1.o_custkey = t3.c_custkey ORDER BY (JULIANDAY(t2.l_receiptdate) - JULIANDAY(t2.l_commitdate)) DESC LIMIT 1
721
retails
bird
How much is the total price of all the orders shipped to customers in Argentina?
train
hard
SELECT SUM(t3.o_totalprice) FROM customer AS t1 INNER JOIN nation AS t2 ON t1.c_nationkey = t2.n_nationkey INNER JOIN orders AS t3 ON t1.c_custkey = t3.o_custkey WHERE t2.n_name = 'argentina'
722
retails
bird
How many customers in the building segments have orders with a total price of no less than 50,000?
train
hard
SELECT COUNT(t2.c_name) FROM orders AS t1 INNER JOIN customer AS t2 ON t1.o_custkey = t2.c_custkey WHERE t2.c_mktsegment = 'building' AND t1.o_totalprice > 50000
723
retails
bird
Which country has the least number of suppliers?
train
hard
SELECT t2.n_name FROM supplier AS t1 INNER JOIN nation AS t2 ON t1.s_nationkey = t2.n_nationkey GROUP BY t1.s_nationkey ORDER BY COUNT(t1.s_name) LIMIT 1
724
retails
bird
How much is the part supply cost for the medium metallic grey dodger linen?
train
hard
SELECT t2.ps_supplycost FROM part AS t1 INNER JOIN partsupp AS t2 ON t1.p_partkey = t2.ps_partkey WHERE t1.p_name = 'medium metallic grey dodger linen'
725
retails
bird
What are the top 2 countries with the highest number of indebted suppliers?
train
hard
SELECT t.n_name FROM (SELECT t2.n_name, SUM(t1.s_acctbal) AS num FROM supplier AS t1 INNER JOIN nation AS t2 ON t1.s_nationkey = t2.n_nationkey WHERE t1.s_acctbal < 0 GROUP BY t1.s_nationkey) AS t ORDER BY t.num LIMIT 2
726
retails
bird
What are the names of the parts that have a part supply cost of at least 1,000?
train
hard
SELECT t1.p_name FROM part AS t1 INNER JOIN partsupp AS t2 ON t1.p_partkey = t2.ps_partkey WHERE t2.ps_supplycost > 1000
727
retails
bird
What is the name of the country of the supplier with the highest debt?
train
hard
SELECT t2.n_name FROM supplier AS t1 INNER JOIN nation AS t2 ON t1.s_nationkey = t2.n_nationkey ORDER BY t1.s_suppkey DESC LIMIT 1
728
retails
bird
Who is the clerk in charge of handling the item with the highest amount of extended price?
train
hard
SELECT t1.o_clerk FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey ORDER BY t2.l_extendedprice DESC LIMIT 1
729
retails
bird
What are the total quantities of the items ordered by customer 101660 on 10/5/1995?
train
hard
SELECT SUM(t2.l_quantity) FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey WHERE t1.o_orderdate = '1995-10-05' AND t1.o_custkey = 101660
730
retails
bird
What is the total amount of tax charged for the order placed by customer 88931 on 7/13/994?
train
hard
SELECT SUM(t2.l_extendedprice * (1 - t2.l_discount) * (1 + t2.l_tax)) FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey WHERE t1.o_custkey = 88931 AND t1.o_orderdate = '1994-07-13'
731
retails
bird
What are the names of the parts that were ordered by customer 110942?
train
hard
SELECT t3.p_name FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey INNER JOIN part AS t3 ON t2.l_partkey = t3.p_partkey WHERE t1.o_custkey = 110942
732
retails
bird
How much is the discounted price of every item that customer 111511 ordered in order 53159? List the names of the parts of every item.
train
hard
SELECT t2.l_extendedprice * (1 - t2.l_discount), t3.p_name FROM orders AS t1 INNER JOIN lineitem AS t2 ON t1.o_orderkey = t2.l_orderkey INNER JOIN part AS t3 ON t2.l_partkey = t3.p_partkey WHERE t1.o_custkey = 111511 AND t1.o_orderkey = 53159
733
sales_in_weather
bird
How many units of item no.9 were sold in store no.1 on 2012/1/1?
train
medium
select units from sales_in_weather where `date` = '2012-01-01' and store_nbr = 1 and item_nbr = 9
734
sales_in_weather
bird
How many units of item no.9 were sold in store no.1 in total in January, 2012?
train
medium
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
735
sales_in_weather
bird
What is the ID of the item that sold the best on 2012/1/1 in store no.1?
train
medium
select item_nbr from sales_in_weather where `date` = '2012-01-01' and store_nbr = 1 order by units desc limit 1
736
sales_in_weather
bird
What was the temperature range of station no.1 on 2012/1/1?
train
medium
select tmax - tmin as temrange from weather where station_nbr = 1 and `date` = '2012-01-01'
737
sales_in_weather
bird
Please list the dates on which the temperature of station no.2 was above the 30-year normal.
train
medium
select `date` from weather where station_nbr = 2 and depart > 0
738
sales_in_weather
bird
On which day was the weather more windy in station no.1, 2012/1/1 or 2012/1/2?
train
easy
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
739
sales_in_weather
bird
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?
train
hard
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
740
sales_in_weather
bird
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?
train
hard
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
741
sales_in_weather
bird
What was the dew point on the day the most units of item no.5 were sold in store no.3 in 2012?
train
hard
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
742
sales_in_weather
bird
On how many days with the max temperature over 90 did the sale of item no.5 in store no.3 exceed 100?
train
hard
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
743
sales_in_weather
bird
How many units of item no.5 were sold in store no.3 on the day the temperature range was the biggest?
train
hard
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
744
sales_in_weather
bird
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?
train
hard
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
745
sales_in_weather
bird
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?
train
hard
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
746
sales_in_weather
bird
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.
train
hard
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
747
sales_in_weather
bird
What is the total units of products sold on the day with the highest max temperature in store no.3 in 2012?
train
hard
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
748
sales_in_weather
bird
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?
train
hard
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 sal...
749
sales_in_weather
bird
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?
train
hard
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....
750
sales_in_weather
bird
On the day with the highest max temperature in 2012, how many items in store no.3 had no sales?
train
hard
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
751
sales_in_weather
bird
How many units of item no.5 were sold in store no.3 on average on the days when the max temperature exceeded 90?
train
hard
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
752
sales_in_weather
bird
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?
train
hard
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(...
753
sales_in_weather
bird
Give the id of the bestsellers of store no.1 on 2012/1/1.
train
medium
select item_nbr from sales_in_weather where `date` = '2012-01-01' and store_nbr = 1 order by units desc limit 1
754
sales_in_weather
bird
How many no.9 items from store no.11 were sold on 2012/12/7?
train
medium
select units from sales_in_weather where `date` = '2012-12-07' and store_nbr = 11 and item_nbr = 9
755
sales_in_weather
bird
Give the average temperature of station no.20 on 2014/10/17.
train
medium
select tavg from weather where `date` = '2014-10-17' and station_nbr = 20
756
sales_in_weather
bird
Tell the resultant wind speed of station no.9 on 2014/1/15.
train
medium
select resultspeed from weather where `date` = '2014-01-15' and station_nbr = 9
757
sales_in_weather
bird
Give the id of the weather station with most stores.
train
hard
SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(station_nbr) DESC LIMIT 1
758
sales_in_weather
bird
Which weather station does store no.20 belong to?
train
medium
SELECT station_nbr FROM relation WHERE store_nbr = 20
759
sales_in_weather
bird
Tell the temperature range of the home weather station of store no.7 on 2014/4/28.
train
hard
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'
760
sales_in_weather
bird
For the weather station which recorded the highest temperature above the 30-year normal, how many stores does it have?
train
easy
SELECT store_nbr FROM relation WHERE station_nbr = (SELECT station_nbr FROM weather ORDER BY depart DESC LIMIT 1)
761
sales_in_weather
bird
For the home weather station of store no.15, what was the dew point on 2012/2/18?
train
hard
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'
762
sales_in_weather
bird
Tell the wet-bulb temperature of the weather station which contained store no.6 on 2012/2/15.
train
hard
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'
763
sales_in_weather
bird
Give the number of stores which opened on the weather station that recorded the fastest average wind speed.
train
easy
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)) AS t
764
sales_in_weather
bird
State the max temperature of the weather station which has the no.21 store on 2012/11/9.
train
hard
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'
765
sales_in_weather
bird
Provide the sunrise time recorded by the home weather station of store no.30 on 2014/2/21.
train
hard
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
766
sales_in_weather
bird
State the number of stores that belongs to the weather station which recorded the deepest snowfall.
train
hard
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
767
sales_in_weather
bird
Provide the code summarization for the weather recorded by the weather station which contained the no.2 store on 2013/2/12.
train
hard
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
768
sales_in_weather
bird
Show the sea level status recorded by the weather station of store no.19 on 2013/2/24.
train
hard
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
769
sales_in_weather
bird
How many inches of total precipitation was recorded by the weather station of store no.2 on 2012/12/25?
train
hard
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
770
sales_in_weather
bird
Give the station pressure status recorded by the weather station which contained no.12 store on 2012/5/15.
train
hard
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
771
sales_in_weather
bird
What percentage was the total unit sales of store no.10 to the total sales of its weather station on 2014/10/31?
train
hard
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'
772
sales_in_weather
bird
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?
train
hard
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 whe...
773
sales_in_weather
bird
What is the item number of the product with the highest number of units sold in store number 1 on 1/1/2012?
train
medium
select item_nbr from sales_in_weather where `date` = '2012-01-01' and store_nbr = 1 order by units desc limit 1
774
sales_in_weather
bird
How many stores are in weather station 12?
train
easy
SELECT SUM(store_nbr) FROM relation WHERE station_nbr = 12
775
sales_in_weather
bird
How many items weren't sold in store 2 on 1/1/2012?
train
medium
select count(item_nbr) from sales_in_weather where store_nbr = 2 and units = 0 and `date` = '2012-01-01'
776
sales_in_weather
bird
Between 1/1/2012 to 12/31/2014, which date recorded the hottest temperature in weather station 1?
train
medium
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
777
sales_in_weather
bird
Which weather station has the highest number of stores?
train
hard
SELECT station_nbr FROM relation GROUP BY station_nbr ORDER BY COUNT(store_nbr) DESC LIMIT 1
778
sales_in_weather
bird
In March 2014, which weather stations recorded the highest number of days whose temperature is below the 30-year normal?
train
medium
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 ord...
779
sales_in_weather
bird
Which weather station does the store that sold the highest quantity of item 9 belongs to?
train
hard
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
780
sales_in_weather
bird
How many stores belong to the most windy station?
train
easy
SELECT COUNT(store_nbr) FROM relation WHERE station_nbr = (SELECT station_nbr FROM weather ORDER BY avgspeed DESC LIMIT 1)
781
sales_in_weather
bird
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?
train
hard
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
782
sales_in_weather
bird
What is the most purchased products during the rainy days in June 2013 in weather station 9?
train
hard
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
783
sales_in_weather
bird
Which station sold the highest quantity of item number 5 overall?
train
hard
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
784
sales_in_weather
bird
What is the earliest sunrise recorded in the stations with no more than 1 store in February 2012?
train
hard
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
785
sales_in_weather
bird
In weather station 17, which store sold the highest quantity of item 45 in October 2012?
train
hard
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
786
sales_in_weather
bird
What are the items sold by the store during the day whose station recorded the thickest snowfall?
train
hard
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
787
sales_in_weather
bird
What are the top 3 stations that have sold the highest quantities for an item in a single day?
train
hard
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
788
sales_in_weather
bird
How many stores belong to the station with the highest recorded heat of all time?
train
hard
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
789
sales_in_weather
bird
On February 8, 2014, what is the minimum temperature in the station where store 29 belongs?
train
hard
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'
790
sales_in_weather
bird
Among the stations with 3 stores, how many stations have a station pressure of no more than 30 on February 18, 2014?
train
medium
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 )
791
sales_in_weather
bird
Which station has the highest number of stores? Calculate the said station's average maximum temperature in February 2012.
train
hard
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'
792
sales_in_weather
bird
Between the stores under weather station 12, what is the percentage of item 5 sold in store 10 in 2014?
train
hard
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%'
793
sales_in_weather
bird
What is the maximum average speed?
train
easy
SELECT MAX(avgspeed) FROM weather
794
sales_in_weather
bird
How many days did the show fell more than 5 inches?
train
easy
select count(distinct `date`) from weather where snowfall > 5
795
sales_in_weather
bird
How many days did the sun rise before 5 AM?
train
easy
select count(distinct `date`) as days from weather where sunrise < time('05:00:00')
796
sales_in_weather
bird
What is the minimum dew point?
train
easy
SELECT MIN(dewpoint) FROM weather
797
sales_in_weather
bird
What is the maximum and minimum temperature for station number 1 on 15 January 2012?
train
medium
select tmax, tmin from weather where station_nbr = 1 and `date` = '2012-01-15'
798
sales_in_weather
bird
How many stations were able to sell item 5 on January 2014?
train
hard
select count(distinct t2.station_nbr) as number from sales_in_weather as t1 inner join relation as t2 on t1.store_nbr = t2.store_nbr where substr(`date`, 1, 7) = '2014-01' and item_nbr = 5
799
sales_in_weather
bird
What is the lowest minimum temperature recorded in store 16 on January 2012?
train
hard
select min(tmin) from weather as t1 inner join relation as t2 on t1.station_nbr = t2.station_nbr where t2.store_nbr = 16 and t1.`date` like '%2012-01%'
800
sales_in_weather
bird
How many units of item 7 have been sold by store 7 when the snow is less than 5 inches?
train
hard
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