db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
regional_sales | select distinct t2.`city name` from regions as t1 inner join `store locations` as t2 on t2.statecode = t1.statecode where t2.state = 'california' and t2.`water area` = '0' | Question: list the store located cities with regions in no water area of california state. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode,... | list the store located cities with regions in no water area of california state. |
regional_sales | select cast(sum(case when t2.`sales team` = 'carlos miller' then 1 else 0 end) as real) * 100 / count(t1.ordernumber) from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid | Question: calculate the order percentage by 'carlos miller' sales team. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latit... | calculate the order percentage by 'carlos miller' sales team. |
regional_sales | select sum(case when t2.`product name` = 'platters' then 1 else 0 end) as num1 , sum(case when t2.`product name` = 'serveware' then 1 else 0 end) as num2 from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid | Question: compare the number of orders between 'platters' and 'serveware' products. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State,... | compare the number of orders between 'platters' and 'serveware' products. |
regional_sales | select sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid order by t2.`median income` desc limit 1 | Question: calculate the total net profit of the store located in highest median income city. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCod... | calculate the total net profit of the store located in highest median income city. |
regional_sales | select count(t1.ordernumber) from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid where t2.region = 'south' and t2.salesteamid between 1 and 9 group by t2.salesteamid having count(t1.ordernumber) | Question: among the sales team in south region, write down the numbers of orders made by the sales team id of one digit. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID,... | among the sales team in south region, write down the numbers of orders made by the sales team id of one digit. |
regional_sales | select sum(iif(orderdate = '5/31/18', 1, 0)) from `sales orders` | Question: how many orders have order date in 5/31/2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, ... | how many orders have order date in 5/31/2018? |
regional_sales | select distinct t from ( select iif(deliverydate = '6/13/18', ordernumber, null) as t from `sales orders` ) where t is not null | Question: list out the name of orders which have delivery date of 6/13/2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, ... | list out the name of orders which have delivery date of 6/13/2018. |
regional_sales | select sum(iif(`order quantity` > 5, 1, 0)) from `sales orders` | Question: how many orders placed were with more than 5 product quantities? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, La... | how many orders placed were with more than 5 product quantities? |
regional_sales | select t from ( select iif(statecode = 'ga', state, null) as t from regions ) where t is not null | Question: state the full name of state code 'ga'. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaCo... | state the full name of state code 'ga'. |
regional_sales | select count(distinct t) from ( select case when region = 'midwest' then statecode else null end as t from regions ) where t is not null | Question: how many states located in the midwest region? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude,... | how many states located in the midwest region? |
regional_sales | select t from ( select distinct iif(t1.`unit cost` = 781.22, t2.`product name`, null) as t from `sales orders` t1 inner join products t2 on t2.productid = t1._productid ) where t is not null | Question: list out the product name of order which has unit cost of 781.22. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, L... | list out the product name of order which has unit cost of 781.22. |
regional_sales | select t from ( select distinct iif(t2.`product name` = 'cookware', t1.deliverydate, null) as t from `sales orders` t1 inner join products t2 on t2.productid = t1._productid ) where t is not null | Question: state the delivery date of cookware. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaCode,... | state the delivery date of cookware. |
regional_sales | select sum(case when t1.orderdate like '%/%/18' and t2.`product name` = 'furniture cushions' then 1 else 0 end) from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid | Question: how many furniture cushions orders which have date of order in 2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type... | how many furniture cushions orders which have date of order in 2018? |
regional_sales | select t from ( select distinct iif(t1.`discount applied` = 0.1, t2.`product name`, null) as t from `sales orders` t1 inner join products t2 on t2.productid = t1._productid ) where t is not null | Question: list out the name of products which have been applied 10% discount. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type,... | list out the name of products which have been applied 10% discount. |
regional_sales | select sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) / count(t1.ordernumber) from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t2.`product name` = 'phones' and t1.`sales channel` = 'distributor' | Question: calculate the average net profit of phones which have sales channel of distributor. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCo... | calculate the average net profit of phones which have sales channel of distributor. |
regional_sales | select sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) / count(t1.ordernumber) from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t2.`product name` = 'bar tools' and t1.`order quantity` > 5 | Question: calculate the average net profit of bar tools which has ordered quantity exceed 5. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCod... | calculate the average net profit of bar tools which has ordered quantity exceed 5. |
regional_sales | select t from ( select distinct case when t1.region = 'south' then t2.`city name` end as t from regions t1 inner join `store locations` t2 on t2.statecode = t1.statecode ) where t is not null | Question: list out the city name of states located in south region. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude,... | list out the city name of states located in south region. |
regional_sales | select t from ( select distinct case when t2.type = 'town' then t1.region end as t from regions t1 inner join `store locations` t2 on t2.statecode = t1.statecode ) where t is not null | Question: what is the region of stores which have type of 'town' in the list? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type,... | what is the region of stores which have type of 'town' in the list? |
regional_sales | select sum(case when t1.`customer names` = 'medsep group' then 1 else 0 end) from customers as t1 inner join `sales orders` as t2 on t2._customerid = t1.customerid | Question: how many orders that medsep group had made? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, Ar... | how many orders that medsep group had made? |
regional_sales | select t from ( select distinct case when t1.`customer names` = 'ole group' then t2.`discount applied` end as t from customers t1 inner join `sales orders` t2 on t2._customerid = t1.customerid ) where t is not null | Question: list out the discount levels applied for all orders from ole group. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type,... | list out the discount levels applied for all orders from ole group. |
regional_sales | select t from ( select distinct case when t2.shipdate = '7/8/18' then t1.`customer names` end as t from customers t1 inner join `sales orders` t2 on t2._customerid = t1.customerid ) where t is not null | Question: state the customer name of orders which has shipped date in 7/8/2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Typ... | state the customer name of orders which has shipped date in 7/8/2018. |
regional_sales | select sum(case when t1.`order quantity` > 4 and t2.`customer names` = 'ei ' then 1 else 0 end) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid | Question: among the orders placed by ei, how many orders have quantity greater than 4? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Sta... | among the orders placed by ei, how many orders have quantity greater than 4? |
regional_sales | select sum(case when t1.`discount applied` = 0.05 and t2.`customer names` = 'pacific ltd' then 1 else 0 end) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid | Question: among the orders placed by pacific ltd, how many orders have been applied 5% discount ? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, Sta... | among the orders placed by pacific ltd, how many orders have been applied 5% discount ? |
regional_sales | select t from ( select distinct case when t2.`unit cost` > 4000 then t1.`customer names` end as t from customers t1 inner join `sales orders` t2 on t2._customerid = t1.customerid ) where t is not null | Question: what is the customer names of orders which have unit cost greater than 4000usd? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, ... | what is the customer names of orders which have unit cost greater than 4000usd? |
regional_sales | select storeid, latitude, longitude from `store locations` where `city name` = 'birmingham' | Question: please list the id and detailed position of all stores in birmingham city. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State... | please list the id and detailed position of all stores in birmingham city. |
regional_sales | select `city name` from `store locations` order by population desc limit 1 | Question: which city has the largest population? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaCod... | which city has the largest population? |
regional_sales | select sum(case when state = 'california' and type = 'cdp' then 1 else 0 end) from `store locations` | Question: how many cdp stores are there in california? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, A... | how many cdp stores are there in california? |
regional_sales | select t1.ordernumber, t2.`product name` from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where replace(t1.`unit price`, ',', '') = ( select replace(t1.`unit price`, ',', '') from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid order by replace(t1.`unit ... | Question: please give the order number and product name of the order which has the lowest unit price. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County,... | please give the order number and product name of the order which has the lowest unit price. |
regional_sales | select t2.`product name` from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t1.orderdate like '%/%/19' order by replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '') desc limit 1 | Question: which product has the highest net profit in 2019? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitu... | which product has the highest net profit in 2019? |
regional_sales | select avg(replace(t1.`unit price`, ',', '')) from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t2.`product name` = 'cookware' | Question: what is the average unit price of a cookware product? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Lon... | what is the average unit price of a cookware product? |
regional_sales | select t from ( select distinct case when t1.orderdate = '5/31/18' then t2.`sales team` else null end as t from `sales orders` t1 inner join `sales team` t2 on t2.salesteamid = t1._salesteamid ) where t is not null | Question: please list all sale team names which had orders on 5/31/2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Lati... | please list all sale team names which had orders on 5/31/2018. |
regional_sales | select t2.`sales team` from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid where t1.orderdate like '%/%/19' group by t2.`sales team` order by count(t1.ordernumber) asc limit 1 | Question: which sales team name has the least orders in 2019? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longi... | which sales team name has the least orders in 2019? |
regional_sales | select substr(t1.orderdate, -2, 2) from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid where t2.`sales team` = 'george lewis' group by substr(t1.orderdate, -2, 2) order by count(t1.ordernumber) desc limit 1 | Question: from 2018 to 2020, which year did the george lewis group have the highest number of orders? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County,... | from 2018 to 2020, which year did the george lewis group have the highest number of orders? |
regional_sales | select cast(sum(case when t2.county = 'orange county' then 1 else 0 end) as real) * 100 / count(t1.ordernumber) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.orderdate like '%/%/18' | Question: what is the percentage of total orders from stores in orange county in 2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Sta... | what is the percentage of total orders from stores in orange county in 2018? |
regional_sales | select ordernumber from `sales orders` where replace(`unit price`, ',', '') = ( select replace(`unit price`, ',', '') from `sales orders` order by replace(`unit price`, ',', '') desc limit 1 ) | Question: which order number has the highest unit price? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude,... | which order number has the highest unit price? |
regional_sales | select _salesteamid from `sales orders` where orderdate like '%/%/18' group by _salesteamid order by count(_salesteamid) desc limit 1 | Question: which sales team id has the highest number of orders in 2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latit... | which sales team id has the highest number of orders in 2018? |
regional_sales | select distinct t from ( select iif(ordernumber = 'so - 000103', `unit cost`, null) as t from `sales orders` ) where t is not null | Question: what is the unit cost of order so - 000103? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, Ar... | what is the unit cost of order so - 000103? |
regional_sales | select sum(case when t2.county = 'maricopa county' and orderdate like '%/%/20' then 1 else 0 end) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid | Question: in 2020, what were the total orders of all stores in maricopa county? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Typ... | in 2020, what were the total orders of all stores in maricopa county? |
regional_sales | select t2.latitude, t2.longitude from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.ordernumber = 'so - 000115' | Question: what is the detailed position of the store which has order so - 000115? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, T... | what is the detailed position of the store which has order so - 000115? |
regional_sales | select count(t1.ordernumber) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.orderdate like '%/%/19' group by t2.`city name` having count(t1.ordernumber) | Question: please calculate the total number of orders by each city in 2019. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, L... | please calculate the total number of orders by each city in 2019. |
regional_sales | select distinct iif(count(t2.customerid) > 3, t2.`customer names`, null) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid where t1.orderdate like '%/%/18' group by t1._customerid having count(t2.customerid) | Question: please list the names of customers who have total orders of over 3 in 2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Stat... | please list the names of customers who have total orders of over 3 in 2018. |
regional_sales | select sum(case when substr(t1.orderdate, -2) in ('18', '19', '20') and t2.`customer names` = 'medsep group' then 1 else 0 end) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid | Question: what were the total orders of medsep group from 2018 to 2020? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latit... | what were the total orders of medsep group from 2018 to 2020? |
regional_sales | select t from ( select distinct case when sum(t1.`order quantity`) > 5 then t2.`customer names` end as t from `sales orders` t1 inner join customers t2 on t2.customerid = t1._customerid where t1.orderdate = '6/1/18' group by t1._customerid ) where t is not null | Question: please list the customer names whose order quantity was more than 5 on 6/1/2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode,... | please list the customer names whose order quantity was more than 5 on 6/1/2018. |
regional_sales | select cast(sum(case when replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '') > 1000 then 1 else 0 end) as real) * 100 / count(t1.ordernumber) from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid where t2.`sales team` = 'stephen payne' | Question: what is the percentage of total orders of stephen payne that had a net profit of over 1000? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County,... | what is the percentage of total orders of stephen payne that had a net profit of over 1000? |
regional_sales | select sum(case when region = 'northeast' then 1 else 0 end) from `sales team` | Question: how many sales team were from northeast? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaC... | how many sales team were from northeast? |
regional_sales | select distinct `city name`, latitude, longitude from `store locations` where county = 'maricopa county' | Question: state the name of all city in maricopa county along with its latitude and longitude. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateC... | state the name of all city in maricopa county along with its latitude and longitude. |
regional_sales | select ordernumber from `sales orders` where replace(`unit cost`, ',', '') = ( select replace(`unit cost`, ',', '') from `sales orders` order by replace(`unit cost`, ',', '') desc limit 1 ) | Question: which order have the highest unit cost? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaCo... | which order have the highest unit cost? |
regional_sales | select t from ( select case when productid between 30 and 40 then `product name` else null end as t from products ) where t is not null | Question: list all the name of products with the id of 30 to 40. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Lo... | list all the name of products with the id of 30 to 40. |
regional_sales | select ( select replace(`unit cost`, ',', '') from `sales orders` where replace(`unit cost`, ',', '') = ( select replace(`unit cost`, ',', '') from `sales orders` order by replace(`unit cost`, ',', '') desc limit 1 ) order by replace(`unit cost`, ',', '') desc limit 1 ) / ( select replace(`unit cost`, ',', '') from `sa... | Question: calculate ratio between the highest unit cost and the lowest unit cost? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, T... | calculate ratio between the highest unit cost and the lowest unit cost? |
regional_sales | select t2.`product name` from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t1.orderdate like '%/%/18' group by t1._productid order by count(t1._productid) desc limit 1 | Question: which product was ordered the most in 2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, Ar... | which product was ordered the most in 2018? |
regional_sales | select sum(case when t2.`sales team` = 'adam hernandez' then 1 else 0 end) from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid | Question: how many products sold by adam hernandez? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, Area... | how many products sold by adam hernandez? |
regional_sales | select t from ( select distinct case when t2.`city name` = 'daly city' then t1.ordernumber end as t from `sales orders` t1 inner join `store locations` t2 on t2.storeid = t1._storeid ) where t is not null | Question: list all orders where its products were shipped from daly city. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Lat... | list all orders where its products were shipped from daly city. |
regional_sales | select sum(case when t1.`customer names` = 'rochester ltd' then 1 else 0 end) from customers as t1 inner join `sales orders` as t2 on t2._customerid = t1.customerid | Question: how many orders made by rochester ltd? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, AreaCod... | how many orders made by rochester ltd? |
regional_sales | select t1.ordernumber from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid where t2.`customer names` = 'qualitest ' order by t1.`order quantity` desc limit 1 | Question: state the order number where qualitest ordered the highest product quantity. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Sta... | state the order number where qualitest ordered the highest product quantity. |
regional_sales | select distinct t1.ordernumber, t2.`product name` from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t1.`sales channel` = 'in-store' | Question: list the order for all in-store sales along with the products sold. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type,... | list the order for all in-store sales along with the products sold. |
regional_sales | select sum(case when t1.orderdate like '5/%/18' and t1.`sales channel` = 'online' and t2.`city name` = 'norman' then 1 else 0 end) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid | Question: how many online sales were made in may 2018 where products were shipped from norman? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateC... | how many online sales were made in may 2018 where products were shipped from norman? |
regional_sales | select t1.`product name` from products as t1 inner join `sales orders` as t2 on t2._productid = t1.productid inner join `store locations` as t3 on t3.storeid = t2._storeid where t3.county = 'maricopa county' order by t2.`order quantity` asc limit 1 | Question: among the products sold in maricopa county, which was the least sold? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Typ... | among the products sold in maricopa county, which was the least sold? |
regional_sales | select t from ( select distinct case when t2.`sales team` = 'samuel fowler' then t1.ordernumber else null end as t from `sales orders` t1 inner join `sales team` t2 on t2.salesteamid = t1._salesteamid ) where t is not null | Question: state all the order numbers for sales team of samuel fowler. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitu... | state all the order numbers for sales team of samuel fowler. |
regional_sales | select count(t2.ordernumber) from products as t1 inner join `sales orders` as t2 on t2._productid = t1.productid where t1.`product name` = 'baseball' and t2.orderdate like '12/%/18' | Question: find the number of baseball ordered in december 2017. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Lon... | find the number of baseball ordered in december 2017. |
regional_sales | select cast(sum(t2.`order quantity`) as real) / 12 from products as t1 inner join `sales orders` as t2 on t2._productid = t1.productid where t1.`product name` = 'ornaments' and t2.orderdate like '%/%/18' | Question: find the average number of ornaments sold each month in 2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latit... | find the average number of ornaments sold each month in 2018. |
regional_sales | select cast(sum(case when t3.`city name` = 'burbank' then t2.`order quantity` else 0 end) as real) * 100 / sum(t2.`order quantity`) from products as t1 inner join `sales orders` as t2 on t2._productid = t1.productid inner join `store locations` as t3 on t3.storeid = t2._storeid where t2.orderdate like '%/%/18' | Question: find the percentage of products that were shipped from burbank in 2018? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, T... | find the percentage of products that were shipped from burbank in 2018? |
regional_sales | select sum(iif(warehousecode = 'ware-mkl1006', 1, 0)) - sum(iif(warehousecode = 'ware-nbv1002', 1, 0)) as difference from `sales orders` | Question: what is the difference in order number from 'ware-mkl1006' and 'ware-nbv1002'? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, S... | what is the difference in order number from 'ware-mkl1006' and 'ware-nbv1002'? |
regional_sales | select t from ( select distinct case when t2.deliverydate like '%/%/21' and t1.`customer names` = 'sundial ' then t3.`product name` end as t from customers t1 inner join `sales orders` t2 on t2._customerid = t1.customerid inner join products t3 on t3.productid = t2._productid ) where t is not null | Question: describe the product names delivered in 2021 for the customer 'sundial'. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, ... | describe the product names delivered in 2021 for the customer 'sundial'. |
regional_sales | select distinct t2.storeid, t1.region from regions as t1 inner join `store locations` as t2 on t2.statecode = t1.statecode where t2.state = 'michigan' | Question: write down the store ids and region of the state 'michigan'. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitu... | write down the store ids and region of the state 'michigan'. |
regional_sales | select sum(case when t2.`customer names` = 'apollo ltd' then 1 else 0 end), sum(case when t2.`customer names` = 'pacific ltd' then 1 else 0 end) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid | Question: compare the total number of orders between customer 'apollo ltd' and 'pacific ltd'. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCo... | compare the total number of orders between customer 'apollo ltd' and 'pacific ltd'. |
regional_sales | select t2.storeid from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t2.`city name` = 'aurora (township)' or t2.`city name` = 'babylon (town)' group by t2.storeid order by count(t1.ordernumber) desc limit 1 | Question: find the store id with more orders between 'aurora' and 'babylon' city. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, T... | find the store id with more orders between 'aurora' and 'babylon' city. |
regional_sales | select distinct t1.`customer names`, t4.`product name` from customers as t1 inner join `sales orders` as t2 on t2._customerid = t1.customerid inner join `sales team` as t3 on t3.salesteamid = t2._salesteamid inner join products as t4 on t4.productid = t2._productid where t3.`sales team` = 'anthony torres' and t2.`sales... | Question: list down the customer names and product names of the order made by 'anthony torres' via distributor channel. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, ... | list down the customer names and product names of the order made by 'anthony torres' via distributor channel. |
regional_sales | select distinct `customer names`, customerid from ( select t2.`customer names`, t2.customerid , sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) as t from `sales orders` t1 inner join customers t2 on t2.customerid = t1._customerid where t1.`sales channel` = 'online' group by t2.customerid ) whe... | Question: mention the customer names and ids which ordered total net profit of above 5000 usd through online channel. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, Ci... | mention the customer names and ids which ordered total net profit of above 5000 usd through online channel. |
regional_sales | select sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid where t1.deliverydate like '%/%/21' and t2.`product name` = 'floral' | Question: find the net profit of the floral products which were delivered in 2021. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, ... | find the net profit of the floral products which were delivered in 2021. |
regional_sales | select count(t1.ordernumber) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t2.population between 3000000 and 4000000 | Question: count the number of orders made from the store in city with population of 3000000 to 4000000. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, Count... | count the number of orders made from the store in city with population of 3000000 to 4000000. |
regional_sales | select t from ( select distinct case when t3.`time zone` = 'pacific/honolulu' and t2.`sales channel` = 'wholesale' then t1.`product name` else null end as t from products t1 inner join `sales orders` t2 on t2._productid = t1.productid inner join `store locations` t3 on t3.storeid = t2._storeid ) where t is not null | Question: name the products via wholesale channel of the store under pacific/honolulu time zone. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, Stat... | name the products via wholesale channel of the store under pacific/honolulu time zone. |
regional_sales | select distinct ordernumber, `product name` from ( select iif(t2.orderdate = '6/6/18', t2.ordernumber, null) as 'ordernumber' , iif(t2.orderdate = '6/6/18', t1.`product name`, null) as 'product name' from products t1 inner join `sales orders` t2 on t2._productid = t1.productid ) where ordernumber is not null and `produ... | Question: list the order numbers and product names which were ordered on 6th june, 2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, S... | list the order numbers and product names which were ordered on 6th june, 2018. |
regional_sales | select count(t1.ordernumber) / 3 from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid where (t1.orderdate like '%/%/18' and t2.`customer names` = 'weimei corp') or (t1.orderdate like '%/%/19' and t2.`customer names` = 'weimei corp') or (t1.orderdate like '%/%/20' and t2.`customer names... | Question: find the average yearly order by customer weimei corp for 2018, 2019 and 2020. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, S... | find the average yearly order by customer weimei corp for 2018, 2019 and 2020. |
regional_sales | select cast(sum(case when t2.warehousecode = 'ware-nmk1003' then 1 else 0 end) as real) / 12 , cast(sum(case when t2.warehousecode = 'ware-nmk1003' then 1 else 0 end) as real) * 100 / count(t2.ordernumber), count(case when t1.`product name` = 'floor lamps' and t2.warehousecode = 'ware-nmk1003' then t2.`order quantity` ... | Question: calculate the average monthly order and percentage of warehouse 'ware-nmk1003' in 2019. among them, mention number of orders for floor lamps. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Regi... | calculate the average monthly order and percentage of warehouse 'ware-nmk1003' in 2019. among them, mention number of orders for floor lamps. |
regional_sales | select distinct t from ( select iif(_customerid = 11, procureddate, null) as t from `sales orders` ) where t is not null | Question: indicate the procured dates for the customer whose id is 11. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitu... | indicate the procured dates for the customer whose id is 11. |
regional_sales | select sum(case when `order quantity` = 1 and `sales channel` = 'distributor' then 1 else 0 end) from `sales orders` | Question: how many orders through distributor were for the minimum quantity? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, ... | how many orders through distributor were for the minimum quantity? |
regional_sales | select distinct t from ( select case when `discount applied` = '0.1' and `sales channel` = 'in-store' then _salesteamid else null end as t from `sales orders` ) where t is not null | Question: list by id all sales teams that have sold products at a 10% discount in store. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, S... | list by id all sales teams that have sold products at a 10% discount in store. |
regional_sales | select sum(case when population < 3000000 and type = 'borough' and `city name` = 'brooklyn' then 1 else 0 end) from `store locations` | Question: how many borough-type stores located in the city of brooklyn have a population of less than 3 million? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Na... | how many borough-type stores located in the city of brooklyn have a population of less than 3 million? |
regional_sales | select count(distinct t) from ( select case when region = 'midwest' then state else null end as t from regions ) where t is not null | Question: how many states are in the midwest region? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitude, Are... | how many states are in the midwest region? |
regional_sales | select t2.`product name` from `sales orders` as t1 inner join products as t2 on t2.productid = t1._productid group by t1._productid order by sum(replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '')) desc limit 10 | Question: what are the top 10 products with the highest net profit? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude,... | what are the top 10 products with the highest net profit? |
regional_sales | select t from ( select distinct case when t2.`order quantity` = 3 and t2.orderdate like '2/%/18' then t1.`customer names` end as t from customers t1 inner join `sales orders` t2 on t2._customerid = t1.customerid ) where t is not null | Question: indicate the name of the customers who have placed an order of 3 units in february 2018. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, St... | indicate the name of the customers who have placed an order of 3 units in february 2018. |
regional_sales | select distinct t3.`sales team` from customers as t1 inner join `sales orders` as t2 on t2._customerid = t1.customerid inner join `sales team` as t3 on t3.salesteamid = t2._salesteamid where t1.`customer names` = 'apotheca, ltd' | Question: what are the names of the sales teams that have served to customer apotheca, ltd? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode... | what are the names of the sales teams that have served to customer apotheca, ltd? |
regional_sales | select t from ( select distinct case when t3.warehousecode = 'ware-uhy1004' then t1.region end as t from regions t1 inner join `store locations` t2 on t2.statecode = t1.statecode inner join `sales orders` t3 on t3._storeid = t2.storeid ) where t is not null | Question: in which regions are the stores that have shipped products through the ware-uhy1004 warehouse? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, Coun... | in which regions are the stores that have shipped products through the ware-uhy1004 warehouse? |
regional_sales | select t from ( select distinct case when t4.`product name` = 'audio' and t3.`sales team` = 'shawn torres' then t1.`city name` else null end as t from `store locations` t1 inner join `sales orders` t2 on t2._storeid = t1.storeid inner join `sales team` t3 on t3.salesteamid = t2._salesteamid inner join products t4 on t... | Question: list all the cities where shawn torres sells audio products. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitu... | list all the cities where shawn torres sells audio products. |
regional_sales | select t3.`product name`, t1.`customer names` from customers as t1 inner join `sales orders` as t2 on t2._customerid = t1.customerid inner join products as t3 on t3.productid = t2._productid where t2.orderdate = '10/21/18' and t2.deliverydate = '11/21/19' | Question: lists the name of the product and customer who placed an order on 10/21/18 and it was delivered on 11/21/19. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, C... | lists the name of the product and customer who placed an order on 10/21/18 and it was delivered on 11/21/19. |
regional_sales | select sum(case when t1.procureddate = '10/27/18' and t2.`city name` = 'orlando' then 1 else 0 end) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid | Question: how many stores procured products on october 27, 2018, in the city of oregon? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, St... | how many stores procured products on october 27, 2018, in the city of oregon? |
regional_sales | select `sales channel` from ( select t1.`sales channel` from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid order by t2.`median income` desc limit 3 ) group by `sales channel` order by count(`sales channel`) desc limit 1 | Question: what sales channels are used the most in the 3 places with the highest median income? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, State... | what sales channels are used the most in the 3 places with the highest median income? |
regional_sales | select t2.`sales team` from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid order by replace(t1.`unit price`, ',', '') - replace(t1.`unit cost`, ',', '') desc limit 5 | Question: list the 5 sales teams that have made sales with the highest net profits. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State,... | list the 5 sales teams that have made sales with the highest net profits. |
regional_sales | select max(t1.`discount applied`) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t2.state = 'colorado' and t2.`land area` = 111039036 | Question: what is the highest discount applied by the store located in a city of the state of colorado whose land area is 111039036. | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations... | what is the highest discount applied by the store located in a city of the state of colorado whose land area is 111039036. |
regional_sales | select count(distinct t2.`time zone`) from regions as t1 inner join `store locations` as t2 on t2.statecode = t1.statecode where t1.region = 'northeast' | Question: how many different time zones are there in the northeast region? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, La... | how many different time zones are there in the northeast region? |
regional_sales | select distinct case when max(t2.population) then t2.type end from regions as t1 inner join `store locations` as t2 on t2.statecode = t1.statecode | Question: what type of store is most popular in the south? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude, Longitud... | what type of store is most popular in the south? |
regional_sales | select t2.region from `sales orders` as t1 inner join `sales team` as t2 on t2.salesteamid = t1._salesteamid where t1.warehousecode = 'ware-mkl1006' group by t2.region order by count(t1.ordernumber) desc limit 1 | Question: to which region does the sales team that has used the ware-mkl1006 warehouse the most times for its shipments belong? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> S... | to which region does the sales team that has used the ware-mkl1006 warehouse the most times for its shipments belong? |
regional_sales | select t2.`city name` from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where replace(t1.`unit price`, ',', '') = ( select replace(t1.`unit price`, ',', '') from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid order by replace(t1.`unit price`, '... | Question: in which city is the store with the highest sales order unit price located? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Stat... | in which city is the store with the highest sales order unit price located? |
regional_sales | select sum(case when t1.`sales channel` = 'online' and t2.`customer names` = 'ole group' and t1.orderdate like '5/%/19' then 1 else 0 end) from `sales orders` as t1 inner join customers as t2 on t2.customerid = t1._customerid | Question: how many online purchases did ole group make in may 2019? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, State, Type, Latitude,... | how many online purchases did ole group make in may 2019? |
regional_sales | select sum(case when t1.`order quantity` = 1 and t1.`sales channel` = 'distributor' and t2.county = 'washtenaw county' then 1 else 0 end) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid | Question: how many stores with less need for products, and purchased through a distributor, are located in washtenaw county? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> Stor... | how many stores with less need for products, and purchased through a distributor, are located in washtenaw county? |
regional_sales | select t1.`product name` from products as t1 inner join `sales orders` as t2 on t2._productid = t1.productid inner join `store locations` as t3 on t3.storeid = t2._storeid where t3.`city name` = 'santa clarita' group by t1.`product name` order by count(t1.`product name`) asc limit 1 | Question: what is the least purchased product by stores in the city of santa clarita? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Stat... | what is the least purchased product by stores in the city of santa clarita? |
regional_sales | select t2.latitude, t2.longitude from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.warehousecode = 'ware-puj1005' group by t2.storeid order by count(t1.warehousecode) asc limit 1 | Question: at what latitude and longitude is the store that has used the ware-puj1005 warehouse the fewest times? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Na... | at what latitude and longitude is the store that has used the ware-puj1005 warehouse the fewest times? |
regional_sales | select cast(sum(case when t2.state = 'new york' then 1 else 0 end) as real) * 100 / count(t1.ordernumber) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.orderdate = '4/4/20' | Question: what percentage of sell orders on 04/04/2020 were for the state of new york? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> StoreID, City Name, County, StateCode, Sta... | what percentage of sell orders on 04/04/2020 were for the state of new york? |
regional_sales | select avg(t2.`land area`) from `sales orders` as t1 inner join `store locations` as t2 on t2.storeid = t1._storeid where t1.`unit price` = '998.30' | Question: what is the average land area of the cities in which stores that purchased products for a unit price of 998.30 are located? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Location... | what is the average land area of the cities in which stores that purchased products for a unit price of 998.30 are located? |
regional_sales | select avg(t2.`household income`) from regions as t1 inner join `store locations` as t2 on t2.statecode = t1.statecode where t2.state = 'new hampshire' and t2.type = 'city' | Question: what is the average household income in cities in the state of new hampshire where there are stores of the type city? | Tables: Customers -> CustomerID, Customer Names. Products -> ProductID, Product Name. Regions -> StateCode, State, Region. Sales Team -> SalesTeamID, Sales Team, Region. Store Locations -> S... | what is the average household income in cities in the state of new hampshire where there are stores of the type city? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.