1sf/bird-sql-train-with-schema huggingface dataset:
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: What genre does Honkai Impact 3rd belong to?
Evidence: Honkai Impact 3rd is the App;
SQL: SELECT DISTINCT Genres FROM playstore WHERE App = 'Honkai Impact 3rd'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: List down the rating for the App Learn C++.
Evidence: FALSE;
SQL: SELECT DISTINCT Rating FROM playstore WHERE App = 'Learn C++'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: What is the average price of games belonging in the arcade genre which has a content rating of Everyone 10+?
Evidence: average price = AVG(Price);
SQL: SELECT AVG(Price) FROM playstore WHERE 'Content Rating' = 'Everyone 10+' AND Genres = 'Arcade'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: How much is the size of Browser 4G and how many users have a pretty positive favorability on it?
Evidence: Browser 4G is the App; pretty positive favorability refers to Sentiment_Polarity score = 0.5
SQL: SELECT T1.Size, COUNT(T1.App) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Browser 4G' AND T2.Sentiment_Polarity >= 0.5
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: Name the Apps with a sentiment objectivity of 0.3 and include their number of installs.
Evidence: FALSE;
SQL: SELECT DISTINCT T1.App, T1.Installs FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment_Polarity = 0.3
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: How much is the average sentiment polarity score of Golf GPS Rangefinder: Golf Pad and what is it's rating in the Google Play Store?
Evidence: average sentiment polarity score = AVG(Sentiment_Polarity); Golf GPS Rangefinder: Golf Pad  is the App;
SQL: SELECT AVG(T2.Sentiment_Polarity), T1.Rating FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Golf GPS Rangefinder: Golf Pad'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: List the top 5 lowest rated puzzle games and count the number of negative sentiments the games received.
Evidence: lowest rating refers to MIN(Rating); puzzle is the genre;
SQL: SELECT T1.App, COUNT(T1.App) COUNTNUMBER FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T2.Sentiment = 'Negative' GROUP BY T1.App ORDER BY T1.Rating LIMIT 5
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: What is the percentage ratio between positive sentiments and negative sentiments that are in Fate/Grand Order? Also indicate the current version.
Evidence: Fate/Grand Order is the App; percentage ratio = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (SUM(Sentiment = 'Negative'))), 100);
SQL: SELECT CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Sentiment = 'Negative' THEN 1 ELSE 0 END), T1.`Current Ver` FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Fate/Grand Order (English)' AND T1.`Current Ver` = '1.18.0'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: Indicate the number of installs and include the percentage of positive sentiments of FREEDOME VPN Unlimited anonymous Wifi Security.
Evidence: FREEDOME VPN Unlimited anonymous Wifi Security is the App; percentage = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (COUNT(*))), 100)
SQL: SELECT T1.Installs , CAST(SUM(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE 0 END) * 100 / SUM(CASE WHEN T2.Sentiment IS NOT NULL THEN 1.0 ELSE 0 END) AS REAL) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'FREEDOME VPN Unlimited anonymous Wifi Security'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: For the Honkai Impact 3rd App, what is the highest sentiment polarity score and what genre does it belong to?
Evidence: highest sentiment polarity score refers to MAX(Sentiment_Polarity);
SQL: SELECT MAX(T2.Sentiment_Polarity), T1.Genres FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Honkai Impact 3rd' AND T2.Sentiment_Polarity > 0.5 GROUP BY T1.Genres
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: What is the rating of Dragon Ball Legends and how many users dislike this App?
Evidence: Dragon Ball Legends is the app; users who dislikes the app refers to Sentiment_Polarity<-0.5;
SQL: SELECT T1.Rating, COUNT(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.App = 'Dragon Ball Legends' AND CAST(Sentiment_Polarity AS INTEGER) < -0.5
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: Which education App has the worst rating and state the translated review if available.
Evidence: education App refers to Category = 'EDUCATION'; worst rated app refers to Rating = 1;
SQL: SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Category = 'EDUCATION' GROUP BY T1.App, T2.Translated_Review ORDER BY T1.Rating ASC LIMIT 1
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: List all free sports Apps and their translated review.
Evidence: paid sports Apps refers to type = 'Paid' and Category = 'SPORTS';
SQL: SELECT T1.App, T2.Translated_Review FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Type = 'Free' AND T1.Category = 'SPORTS'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: Among the role playing game genre, how many are targeted to teens and what is their average sentiment polarity score?
Evidence: targeted to teen refers to Content Rating = 'Teen'; average = AVG(Sentiment_Polarity);
SQL: SELECT COUNT(T1.App), AVG(T2.Sentiment_Polarity) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1."Content Rating" = 'Teen' AND T1.Genres = 'Role Playing'
Database: app_store
Tables: playstore, user_reviews
Columns (table index, column name): -1, *, 0, App, 0, Category, 0, Rating, 0, Reviews, 0, Size, 0, Installs, 0, Type, 0, Price, 0, Content Rating, 0, Genres, 1, App, 1, Translated_Review, 1, Sentiment, 1, Sentiment_Polarity, 1, Sentiment_Subjectivity
Question: What is the average rating of Apps falling under the racing genre and what is the percentage ratio of positive sentiment reviews?
Evidence: average rating = AVG(Rating); percentage = MULTIPLY(DIVIDE((SUM(Sentiment = 'Positive')), (COUNT(*)), 100));
SQL: SELECT AVG(T1.Rating), CAST(COUNT(CASE WHEN T2.Sentiment = 'Positive' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.Sentiment) FROM playstore AS T1 INNER JOIN user_reviews AS T2 ON T1.App = T2.App WHERE T1.Genres = 'Racing'
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 region has the most number of sales team?
Evidence: the most number of sales team refers to MAX(COUNT(Sales Team));
SQL: SELECT Region FROM `Sales Team` GROUP BY Region ORDER BY COUNT(DISTINCT `Sales Team`) 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: List all the customers with name containing the word 'Group'.
Evidence: name containing the word 'Group' refers to Customer Names LIKE '%Group%';
SQL: SELECT T FROM ( SELECT IIF(`Customer Names` LIKE '%Group%', `Customer Names`, NULL) AS T FROM Customers ) 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 average median income for all City type of stores?
Evidence: AVG(Median Income) where Type = 'City';
SQL: SELECT AVG(`Median Income`) FROM `Store Locations` WHERE Type = 'City'
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: Name the sales team and the region of order number 'SO - 000137'.
SQL: SELECT T2.`Sales Team`, T2.Region FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderNumber = 'SO - 000137'
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 all the order numbers along with its product name for each order under the sales team of 'Douglas Tucker'.
SQL: SELECT DISTINCT T1.ProductID, T1.`Product Name` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T3.`Sales Team` = 'Douglas Tucker'
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 orders in 2020, name the customers who had the greatest discount applied for 'Cocktail Glasses'
Evidence: MAX(Discount Applied) where Product Name = 'Cocktail Glasses'; orders in 2020 refer to the OrderDate between 01-01-2020 and 31-12-2020;
SQL: SELECT DISTINCT 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 T3.`Product Name` = 'Cocktail Glasses' AND SUBSTR(T2.OrderDate, -2) = '20' AND T2.`Discount Applied` = ( SELECT T2.`Discount Applied` 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 T3.`Product Name` = 'Cocktail Glasses' AND T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Discount Applied` 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: List all the order numbers for In-Store sales and find the city where the store is located.
Evidence: In-Store sales refer to Sales Channel = 'In-Store'; city refers to City Name;
SQL: SELECT DISTINCT T1.OrderNumber, T2.`City Name` FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T1.`Sales Channel` = 'In-Store'
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: Name the most expensive ordered? Who, when was it ordered?
Evidence: the most expensive refers to MAX(Unit Cost); who refers to Customer Names; when refers to OrderDate;
SQL: SELECT T2.OrderNumber, T1.`Customer Names`, T2.OrderDate 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 ORDER BY T2.`Unit Cost` 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: List all the numbers ordered by 'Rochester Ltd' in 2018.
Evidence: Rochester Ltd is the name of the customer; all the numbers ordered refer to OrderNumber; 2018 refers to SUBSTR(OrderDate, -2) = '18';
SQL: SELECT DISTINCT T FROM ( SELECT CASE  WHEN T1.OrderDate LIKE '%/%/18' AND T2.`Customer Names` = 'Rochester Ltd' THEN T1.OrderNumber ELSE NULL END AS T FROM `Sales Orders` T1 INNER JOIN Customers 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: Provide all the orders from WARE-NMK1003. Name the product and sales team for each of these order.
Evidence: all the orders from WARE-NMK1003 refer to OrderNumber where WarehouseCode = 'WARE-NMK1003'; product refers to Product Name;
SQL: SELECT DISTINCT T1.`Product Name`, T3.`Sales Team` FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.WarehouseCode = 'WARE-NMK1003'
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 the name of all customers who had made orders online.
Evidence: orders online refer to Sales Channel = 'Online';
SQL: SELECT T FROM ( SELECT CASE  WHEN T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` ELSE NULL 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: Calculate the average net profit for bakeware product.
Evidence: net profit can be computed as SUBTRACT(Unit Price, Unit Cost); AVG(net profit) where Product Name = 'Bakeware';
SQL: SELECT AVG(REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', ''))  FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T2.`Product Name` = 'Bakeware'