1sf/bird-sql-train-with-schema huggingface dataset:
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: How many orders placed were with more than 5 product quantities?
Evidence: orders refer to OrderNumber; more than 5 product quantities refer to Order Quantity > 5;
SQL: SELECT SUM(IIF(`Order Quantity` > 5, 1, 0)) FROM `Sales Orders`
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: State the full name of state code "GA".
SQL: SELECT T FROM ( SELECT IIF(StateCode = 'GA', State, NULL) AS T FROM Regions ) WHERE T IS NOT NULL
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: How many states located in the Midwest region?
SQL: SELECT COUNT(DISTINCT T) FROM ( SELECT CASE  WHEN Region = 'Midwest' THEN StateCode ELSE NULL END AS T FROM Regions ) WHERE T IS NOT NULL
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: List out the product name of order which has unit cost of 781.22.
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: State the delivery date of cookware.
Evidence: Cookware is the name of the product;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: How many furniture cushions orders which have date of order in 2018?
Evidence: furniture cushions orders refer to OrderNumber where Product Name = 'Furniture Cushions'; date of order in 2018 refers to SUBSTR(OrderDate, -2) = '18'
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: List out the name of products which have been applied 10% discount.
Evidence: applied 10% discount refers to Discount Applied = 0.1;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Calculate the average net profit of phones which have sales channel of distributor.
Evidence: net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Phones' and Sales Channel = 'Distributor';
SQL: 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'
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Calculate the average net profit of bar tools which has ordered quantity exceed 5.
Evidence: net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Bar Tools' and Order Quantity > 5;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: List out the city name of states located in South region.
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: What is the region of stores which have type of "Town" in the list?
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: How many orders that Medsep Group had made?
Evidence: Medsep Group is the name of the customer; orders refer to OrderNumber;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: List out the discount levels applied for all orders from Ole Group.
Evidence: Ole Group is the name of the customer; discount levels applied refer to Discount Applied NOT NULL;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: State the customer name of orders which has shipped date in 7/8/2018.
Evidence: shipped date in 7/8/2018 refers to ShipDate = '7/8/18'
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Among the orders placed by Ei, how many orders have quantity greater than 4?
Evidence: Ei is the name of the customer; orders have quantity greater than 4 refer to OrderNumber WHERE Order Quantity > 4;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Among the orders placed by Pacific Ltd, how many orders have been applied 5% discount ?
Evidence: orders by Pacific Ltd refer to OrderNumber where Customer Names = 'Pacific Ltd'; applied 5% discount refers to Discount Applied = 0.05;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: What is the customer names of orders which have unit cost greater than 4000USD?
Evidence: unit cost greater than 4000USD refers to Unit Cost > 4000;
SQL: 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
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Please list the id and detailed position of all stores in Birmingham city.
Evidence: Latitude and Longitude coordinates can be used to identify the detailed position of stores; id refers to StoreID;
SQL: SELECT StoreID, Latitude, Longitude FROM `Store Locations` WHERE `City Name` = 'Birmingham'
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Which city has the largest population?
Evidence: city has the largest population refers to City Name where MAX(Population);
SQL: SELECT `City Name` FROM `Store Locations` ORDER BY Population DESC LIMIT 1
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: How many CDP stores are there in California?
Evidence: California is a state; CDP stores refer to StoreID where Type = 'CDP';
SQL: SELECT SUM(CASE WHEN State = 'California' AND Type = 'CDP' THEN 1 ELSE 0 END) FROM `Store Locations`
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Please give the order number and product name of the order which has the lowest unit price.
Evidence: the lowest unit price refers to MIN(Unit Price);
SQL: 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 Price`, ',', '') LIMIT 1 )
Database: regional_sales
Tables: Customers, Products, Regions, Sales Team, Store Locations, Sales Orders
Columns (table index, column name): -1, *, 0, CustomerID, 0, Customer Names, 1, ProductID, 1, Product Name, 2, StateCode, 2, State, 2, Region, 3, SalesTeamID, 3, Sales Team, 3, Region, 4, StoreID, 4, City Name, 4, County, 4, StateCode, 4, State, 4, Type, 4, Latitude, 4, Longitude, 4, AreaCode, 4, Population, 4, Household Income, 4, Median Income, 4, Land Area, 4, Water Area, 4, Time Zone, 5, OrderNumber, 5, Sales Channel, 5, WarehouseCode, 5, ProcuredDate, 5, OrderDate, 5, ShipDate, 5, DeliveryDate, 5, CurrencyCode, 5, _SalesTeamID, 5, _CustomerID, 5, _StoreID, 5, _ProductID, 5, Order Quantity, 5, Discount Applied, 5, Unit Price, 5, Unit Cost
Question: Which product has the highest net profit in 2019?
Evidence: net profit can be computed as SUBTRACT(Unit Price, Unit Cost); the highest net profit in 2019 refers to MAX(Net Profit) where OrderDate LIKE '%/19'; product refers to Product Name;
SQL: 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