Chinastark/bird_dataset huggingface dataset:
Database: regional_sales
Question: How many orders made by Rochester Ltd?
Evidence: Rochester Ltd is the name of the customer; orders refer to OrderNumber;
SQL: 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
Database: regional_sales
Question: State the order number where Qualitest ordered the highest product quantity.
Evidence: Qualitest ordered the highest product quantity refers to Customer Names where MAX(Order Quantity);
SQL: 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
Database: regional_sales
Question: List the order for all in-store sales along with the products sold.
Evidence: orders for all in-store sales refer to OrderNumber where Sales Channel = 'In-Store'; products refer to Product Name;
SQL: 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'
Database: regional_sales
Question: How many online sales were made in May 2018 where products were shipped from Norman?
Evidence: online sales refer to OrderNumber where Sales Channel = 'Online'; May 2018 refers to OrderDate LIKE '5/%/18'; Norman is the name of the city;
SQL: 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
Database: regional_sales
Question: Among the products sold in Maricopa County, which was the least sold?
Evidence: the least sold product refers to Product Name where MIN(Order Quantity);
SQL: 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
Database: regional_sales
Question: State all the order numbers for sales team of Samuel Fowler.
SQL: 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
Database: regional_sales
Question: Find the number of baseball ordered in December 2017.
Evidence: Product Name = 'Baseball'; December 2017 refers to OrderDate LIKE '12/%/17';
SQL: 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'
Database: regional_sales
Question: Find the average number of ornaments sold each month in 2018.
Evidence: DIVIDE(SUM(Order Quantity where Product Name = 'Ornaments' and OrderDate LIKE '%/18'), 12);
SQL: 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'
Database: regional_sales
Question: Find the percentage of products that were shipped from Burbank in 2018?
Evidence: DIVIDE(SUM(Order Quantity where City Name = 'Burbank' and SUBSTR(OrderDate, -2) = '18')), (SUM(Order Quantity where SUBSTR(OrderDate, -2) = '18')) as percentage;
SQL: 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'
Database: regional_sales
Question: What is the difference in order number from "WARE-MKL1006" and "WARE-NBV1002"?
Evidence: "WARE-NBV1002" and "WARE-MKL1006" are both WarehouseCode; difference in order number = Subtract(Count(OrderNumber where WarehouseCode = 'WARE-MKL1006'), Count(OrderNumber where WarehouseCode = 'WARE-NBV1002'))
SQL: SELECT SUM(IIF(WarehouseCode = 'WARE-MKL1006', 1, 0)) - SUM(IIF(WarehouseCode = 'WARE-NBV1002', 1, 0)) AS difference FROM `Sales Orders`
Database: regional_sales
Question: Describe the product names delivered in 2021 for the customer "Sundial".
Evidence: delivered in 2021 refer to DeliveryDate LIKE '%/21'; 'Sundial' is the Customer Names
SQL: 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
Database: regional_sales
Question: Write down the store IDs and region of the state "Michigan".
Evidence: "Michigan" is the State
SQL: 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'
Database: regional_sales
Question: Compare the total number of orders between customer "Apollo Ltd" and "Pacific Ltd".
Evidence: "Apollo Ltd" and "Pacific Ltd" are both Customer Names; total number of orders refers to COUNT(OrderNumber)
SQL: 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
Database: regional_sales
Question: Find the store ID with more orders between "Aurora" and "Babylon" city.
Evidence: "Aurora" refers to City Name = 'Aurora (Township)'; "Babylon" refers to City Name = 'Babylong (Town)'; more order refers to Max(Count(OrderNumber))
SQL: 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
Database: regional_sales
Question: List down the customer names and product names of the order made by "Anthony Torres" via distributor channel.
Evidence: "Anthony Torres" is the name of Sales Team; distributor channel refers to Sales Channel = 'Distributor'
SQL: 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 Channel` = 'Distributor'
Database: regional_sales
Question: Mention the customer names and IDs which ordered total net profit of above 5000 USD through online channel.
Evidence: IDs refers to CustomerID; total net profit of above 5000 USD refers to SUM(Subtract(Unit Price, Unit Cost)) > 5000
SQL: 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 ) WHERE T > 5000
Database: regional_sales
Question: Find the net profit of the floral products which were delivered in 2021.
Evidence: floral product refers to Product Name = 'Floral'; total net profit = SUM(Subtract(Unit Price, Unit Cost)); delivered in 2021 refers to DeliveryDate LIKE '%/21'
SQL: 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'
Database: regional_sales
Question: Count the number of orders made from the store in city with population of 3000000 to 4000000.
Evidence: number of order refers to OrderNumber; population of 3000000 to 4000000 refers to Population BETWEEN 3000000 AND 4000000
SQL: 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
Database: regional_sales
Question: Name the products via wholesale channel of the store under Pacific/Honolulu time zone.
Evidence: products refers to Product Name; via wholesale channel refers to Sales Channel = 'Wholesale'
SQL: 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
Database: regional_sales
Question: List the order numbers and product names which were ordered on 6th June, 2018.
Evidence: ordered on 6th June 2018 refers to OrderDate = '6/5/18'
SQL: 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 `Product Name` IS NOT NULL
Database: regional_sales
Question: Find the average yearly order by customer Weimei Corp for 2018, 2019 and 2020.
Evidence: "Weimei Corp" is the Customer Names; in 2018, 2019 and 2020 refers to SUBSTR (OrderDate, -2) IN ('18', '19', '20') : Average order = Divide (Count (OrderNumber), 3)
SQL: 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` = 'Weimei Corp')
Database: regional_sales
Question: Calculate the average monthly order and percentage of warehouse "WARE-NMK1003" in 2019. Among them, mention number of orders for floor lamps.
Evidence: "WARE-NMK1003" is the WarehouseCode; in 2019 refers to SUBSTR(OrderDate, -2) = '19'; average = Divide (Count (OrderNumber where SUBSTR(OrderDate, -2) = '19'), 12); Percentage = Divide (Count(OrderNumber where WarehouseCode = 'WARE-NMK1003'), Count(OrderNumber)) * 100; 'Floor Lamps' is the Product Name; number of orders refers to Count(OrderNumber)
SQL: 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` ELSE NULL END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID WHERE T2.OrderDate LIKE '%/%/19'
Database: regional_sales
Question: Indicate the procured dates for the customer whose ID is 11.
Evidence: ID is 11 refers to _CustomerID = 11;
SQL: SELECT DISTINCT T FROM ( SELECT IIF(_CustomerID = 11, ProcuredDate, NULL) AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
Database: regional_sales
Question: How many orders through distributor were for the minimum quantity?
Evidence: "Distributor" is the Sales Channel; minimum quantity refers to Min(Order Quantity)
SQL: SELECT SUM(CASE WHEN `Order Quantity` = 1 AND `Sales Channel` = 'Distributor' THEN 1 ELSE 0 END) FROM `Sales Orders`
Database: regional_sales
Question: List by ID all sales teams that have sold products at a 10% discount in store.
Evidence: ID refers to _SalesTeamID; 10% discount refers to Discount Applied = 0.1; 'In-Store' is the Sales Channel
SQL: 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
Database: regional_sales
Question: How many Borough-type stores located in the city of Brooklyn have a population of less than 3 million?
Evidence: "Brooklyn" is the CityName; population of less than 3 million refers to Population < 3000000
SQL: SELECT SUM(CASE WHEN Population < 3000000 AND Type = 'Borough' AND `City Name` = 'Brooklyn' THEN 1 ELSE 0 END) FROM `Store Locations`
Database: regional_sales
Question: How many states are in the Midwest region?
SQL: SELECT COUNT(DISTINCT T) FROM ( SELECT CASE  WHEN Region = 'Midwest' THEN State ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
Database: regional_sales
Question: What are the top 10 products with the highest net profit?
Evidence: products refers to Product Name; highest net profit = Max(Subtract(Unit Price, Unit Cost))
SQL: 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
Database: regional_sales
Question: Indicate the name of the customers who have placed an order of 3 units in February 2018.
Evidence: name of customer refers to Customer Names; order of 3 unit refers to Order Quantity = 3; in February 2018 refers to OrderDate LIKE '2/%/18'
SQL: 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
Database: regional_sales
Question: What are the names of the sales teams that have served to customer Apotheca, Ltd?
Evidence: name of sales team refers to Sales Team; 'Apotheca, Ltd' is the Customer Names
SQL: 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'
Database: regional_sales
Question: In which regions are the stores that have shipped products through the WARE-UHY1004 warehouse?
Evidence: "WARE-UHY1004" is the WarehouseCode
SQL: 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
Database: regional_sales
Question: List all the cities where Shawn Torres sells Audio products.
Evidence: "Shawn Torres" is the name of Sales Team; Audio product refers to Product Name = 'Audio'
SQL: 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 T4.ProductID = T2._ProductID ) WHERE T IS NOT NULL
Database: regional_sales
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.
Evidence: ordered on 10/21/18 refers to OrderDate = '10/21/18'; delivered on 11/21/19 refers to DeliveryDate = '11/21/19'; name of product refers to Product Name
SQL: 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'
Database: regional_sales
Question: How many stores procured products on October 27, 2018, in the city of Oregon?
Evidence: October 27, 2018 refers to ProcuredDate = '10/27/18'; 'Oregon' is the State
SQL: 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
Database: regional_sales
Question: What sales channels are used the most in the 3 places with the highest median income?
Evidence: highest median income refers to Max(Median Income)
SQL: 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
Database: regional_sales
Question: List the 5 sales teams that have made sales with the highest net profits.
Evidence: highest net profit = Max(Subtract (Unit Price, Unit Cost))
SQL: 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
Database: regional_sales
Question: What is the highest discount applied by the store located in a city of the state of Colorado whose land area is 111039036.
Evidence: highest discount applied refers to Max(Discount Applied)
SQL: 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
Database: regional_sales
Question: How many different time zones are there in the Northeast region?
SQL: 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'
Database: regional_sales
Question: What type of store is most popular in the South?
Evidence: in the South refers to Region = 'South'; type of store that is most popular refers to Max(Count(Type))
SQL: 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
Database: regional_sales
Question: To which region does the sales team that has used the WARE-MKL1006 warehouse the most times for its shipments belong?
Evidence: "WARE-MKL1006" is the WarehouseCode; most shipment to region refers to Max(Count(Region))
SQL: 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
Database: regional_sales
Question: In which city is the store with the highest sales order unit price located?
Evidence: highest sales order unit price refers to Max(Unit Price)
SQL: 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`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: How many online purchases did Ole Group make in May 2019?
Evidence: "Ole Group" is the Customer Names; online purchase refers to Sales Channel = 'Online'; made in May 2019 refers to OrderDate LIKE '5/%/19'
SQL: 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
Database: regional_sales
Question: How many stores with less need for products, and purchased through a distributor, are located in Washtenaw County?
Evidence: less need for products refers to Order Quantity = 1; purchased through a distributor refers to Sales Channel = 'Distributor'; 'Harri County' is the County
SQL: 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
Database: regional_sales
Question: What is the least purchased product by stores in the city of Santa Clarita?
Evidence: least purchased product refers to Min(Count(Product Name)); 'Santa Clarita' is the City
SQL: 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
Database: regional_sales
Question: At what Latitude and Longitude is the store that has used the WARE-PUJ1005 warehouse the fewest times?
Evidence: WARE-PUJ1005 is the WarehouseCode; fewest times refers to Min (Count(WarehouseCode))
SQL: 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
Database: regional_sales
Question: What percentage of sell orders on 04/04/2020 were for the state of New York?
Evidence: sales order on 04/04/2020 refers to OrderDate = '4/4/20'; 'New York' is  the City Name; percentage = Divide (Sum(OrderNumber where City Name = 'New York'), Count (OrderNumber)) * 100
SQL: 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'
Database: regional_sales
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?
Evidence: average land area = Divide (Sum(Land Area), Count(Land Area))
SQL: 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'
Database: regional_sales
Question: What is the average household income in cities in the state of New Hampshire where there are stores of the type city?
Evidence: "New Hampshire" is the State; average household income = AVG(Household Income)
SQL: 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'
Database: regional_sales
Question: How many sales teams are there in the Midwest?
Evidence: "Midwest" is the Region
SQL: SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
Database: regional_sales
Question: Indicate order numbers with an order date after 1/1/2018.
Evidence: order date after 1/1/2018 refers to OrderDate > '1/1/2018'
SQL: SELECT DISTINCT T FROM ( SELECT CASE  WHEN OrderDate > '1/1/18' THEN OrderNumber ELSE NULL END AS T FROM `Sales Orders` ) WHERE T IS NOT NULL
Database: regional_sales
Question: How many sales channels does the sales team have in the Midwest?
Evidence: "Midwest" is the Region
SQL: SELECT COUNT(T1.`Sales Channel`) FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest'
Database: regional_sales
Question: Which sales team has the other with the highest unit price?
Evidence: highest unit price refers to Max(Unit Price)
SQL: SELECT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE REPLACE(T1.`Unit Price`, ',', '') = ( SELECT REPLACE(T1.`Unit Price`, ',', '') FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(T1.`Unit Price`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: Which regions have online sales channels that have the most discounts?
Evidence: most discount refers to Max(Discount Applied)
SQL: SELECT T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.`Sales Channel` = 'Online' ORDER BY T1.`Discount Applied` DESC LIMIT 1
Database: regional_sales
Question: Which Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?
Evidence: "Apollo Ltd" is the Customer Names; most expensive unit price refers to max(Unit Price)
SQL: SELECT T1.OrderNumber, T1.OrderDate FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Apollo Ltd' ORDER BY T1.`Unit Price` DESC LIMIT 1