db_id
stringclasses 69
values | question
stringlengths 24
325
| evidence
stringlengths 1
673
⌀ | SQL
stringlengths 23
804
| schema
stringclasses 69
values |
|---|---|---|---|---|
regional_sales
|
How many sales teams are there in the Midwest?
|
"Midwest" is the Region
|
SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Indicate order numbers with an order date after 1/1/2018.
|
order date after 1/1/2018 refers to OrderDate > '1/1/2018'
|
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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How many sales channels does the sales team have in the Midwest?
|
"Midwest" is the Region
|
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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which sales team has the other with the highest unit price?
|
highest unit price refers to Max(Unit Price)
|
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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which regions have online sales channels that have the most discounts?
|
most discount refers to Max(Discount Applied)
|
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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?
|
"Apollo Ltd" is the Customer Names; most expensive unit price refers to max(Unit Price)
|
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
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Provide order number, warehouse code of customers Elorac, Corp.
|
"Elorac, Corp" is the Customer Names
|
SELECT DISTINCT T1.OrderNumber, T1.WarehouseCode FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Elorac, Corp'
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Name of customers who have ordered Cocktail Glasses by online sales channel.
|
"Cocktail Glasses" is the Product Name; customer refers to Customer Names
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN T3.`Product Name` = 'Cocktail Glasses' AND T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` 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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which store in Arizona has the most net profit?
|
"Arizona" is the name of State; most net profit = Max(Subtract( Unit Price, Unit Cost))
|
SELECT T2.StoreID FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.State = 'Arizona' ORDER BY T1.`Unit Price` - T1.`Unit Cost` DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How much more is the Florida store's computer product unit price than the Texas store?
|
"Florida" and "Texas" are both the name of State; Computer product refers to Product Name = 'Computers; difference in unit price = Subtract (Unit Price where State = 'Florida', Unit Price where State = 'Texas')
|
SELECT SUM(CASE WHEN T3.State = 'Florida' THEN T2.`Unit Price` ELSE 0 END) - SUM(CASE WHEN T3.State = 'Texas' THEN T2.`Unit Price` ELSE 0 END) 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 T1.`Product Name` = 'Computers'
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Among sales teams in Midwest region, which sales team has an order quantity greater than 5?
|
order quantity greater than 5 refers to Order Quantity > 5
|
SELECT DISTINCT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest' AND T1.`Order Quantity` > 5
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Please indicate store id in the state of California that have been applied 20% discount in store.
|
"California" is the name of State; in store refers to Sales Channel = 'In-Store'; 20% discount refers to Discount Applied = '0.2'
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.State = 'California' AND T1.`Sales Channel` = 'In-Store' AND T1.`Discount Applied` = 0.2 THEN T2.StoreID END AS T FROM `Sales Orders` T1 INNER JOIN `Store Locations` T2 ON T2.StoreID = T1._StoreID ) WHERE T IS NOT NULL
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
List the name of the customer with the most number of order quantity from 2018 to 2020.
|
name of customer refers to Customer Names; from 2018 to 2020 refers to OrderDate between '1/1/2018' and '31/12/2020'; most number of order quantity refers to Order Quantity = 8
|
SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID WHERE T2.OrderDate LIKE '%/%/18' OR T2.OrderDate LIKE '%/%/19' OR T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Order Quantity` DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Please indicate total order quantity of product Candles and calculate the percentage of such product among all the orders.
|
total order quantity refers to Sum (Order Quantity); 'Candles' is the Products Name; percentage = Divide (Sum(Order Quantity where Product Name = 'Candles'), Sum(Order Quantity)) * 100
|
SELECT SUM(CASE WHEN T1.`Product Name` = 'Candles' THEN T2.`Order Quantity` ELSE 0 END), CAST(SUM(CASE WHEN T1.`Product Name` = 'Candles' 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
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which region is Joshua Bennet located in?
|
"Joshua Bennett" is the name of Sales Team
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN `Sales Team` = 'Joshua Bennett' THEN Region ELSE NULL END AS T FROM `Sales Team` ) WHERE T IS NOT NULL
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the store id of the store located in the most populous county?
|
most populous country refers to Max(Population)
|
SELECT CASE WHEN MAX(Population) THEN StoreID END FROM `Store Locations`
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How many sales teams are there in the Midwest?
|
"Midwest" is the Region
|
SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the type of store located in the city with the highest amount of water area?
|
type of store in City refers to Type = 'City'; highest amount of water area refers to Max(Water Area)
|
SELECT CASE WHEN MAX(`Water Area`) THEN Type END FROM `Store Locations`
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How many online orders were shipped during the month of June 2018?
|
online orders refers to Sales Channel = 'Online'; shipped during the month of June 2018 refers to SUBSTR(ShipDate, 1, 1) = '6' AND SUBSTR(ShipDate,-2) = '18'
|
SELECT SUM(IIF(ShipDate LIKE '6/%/18' AND `Sales Channel` = 'Online', 1, 0)) FROM `Sales Orders`
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How much is the discount applied to the order with the highest unit price?
|
highest unit price refers to Max(Unit Price)
|
SELECT `Discount Applied` FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the name of the product with the highest net profit?
|
highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of product refers to Product Name
|
SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
In the Northeast region, what is the average household income for each city located in the state with the highest number of stores?
|
average household income = Divide (Sum(Household Income), Count(City Name)); highest number of store refers to Max(Count(StoreID))
|
SELECT AVG(T2.`Household Income`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast' GROUP BY T2.State ORDER BY COUNT(T2.StoreID) DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
In which region can you find the stores located in the state whose median income is no more than 30,000?
|
median income no more than 30,000 refers to Median Income < 30,000
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.`Median Income` < 30000 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 name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
In the West, how many stores are there in the city whose land area is below 20,000,000?
|
"West" is the Region; land area is below 20,000,000 refers to Land Area < 20,000,000
|
SELECT SUM(CASE WHEN T1.Region = 'West' AND T2.`Land Area` < 20000000 THEN 1 ELSE 0 END) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the name of the customer who purchased the product with the highest net profiit?
|
highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of customer refers to Customer Names
|
SELECT `Customer Names` FROM ( SELECT T1.`Customer Names`, T2.`Unit Price` - T2.`Unit Cost` AS "net profit" FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY `net profit` DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
In 2019, how many orders were shipped by the sales team with the highest number of orders in the said year? Provide the name of the sales team.
|
shipped refers to ShipDate; in 2019 refers to shipped in 2019 refers to SUBSTR(ShipDate, -2) = '19'; order in the said year refers to SUBSTR(OrderDate, -2) = '19'; highest number of order refers to Max(Count(OrderNumber))
|
SELECT COUNT(T1.OrderNumber), T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' AND T1.ShipDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Among the products with an order quantity of no less than 5 that was shipped in the month of May 2019, what is the name of the product with the lowest net profit?
|
order quantity of no less than 5 refers to Order Quantity > 5; shipped in the month of May 2019 refers to ShipDate LIKE '5/%/19'; lowest net profit = Min(Subtract(Unit Price, Unit Cost)); name of product refers to Products Name
|
SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.`Order Quantity` > 5 AND ShipDate LIKE '5/%/19' ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') ASC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the detailed coordinates of the store where the product with the 4th highest profit were purchased from?
|
detailed coordinates refers to Latitude, Longitude; highest net profit = Max(Subtract(Unit Price, Unit Cost))
|
SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 3, 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How many orders were shipped by the sales team with the highest amount of shipped orders in 2020? Give the name of the said sales team.
|
shipped refers to ShipDate; in 2020 refers to SUBSTR(ShipDate, -2) = '20'; highest amount of shipped orders refers to Max(Count(OrderNumber))
|
SELECT COUNT(T1.OrderNumber), T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.ShipDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Between 2018 to 2020, what is the average amount of shipped orders per year under Carl Nguyen?
|
shipped refers to ShipDate; between 2018 and 2020 refers to SUBSTR(ShipDate, -2) IN ('18', '19', '20'); 'Carl Nguyen' is the name of Sales Team; average shipped orders per year = Divide (Count(OrderNumber), 3)
|
SELECT CAST(COUNT(T1.OrderNumber) AS REAL) / 3 FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/18') OR (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/19') OR (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/20')
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the amount of discount applied to the product with the highest net profit and what is the name of the said product?
|
highest net profit refers to Max(Subtract(Unit Price, Unit Cost)); name of product refers to Product Name
|
SELECT T1.`Unit Price` * T1.`Discount Applied`, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What are the names of the top 3 customers who paid the highest amount of price per order after discount?
|
highest price per order after discount refers to Max(Subtract(Multiply (Unit Price, Order Quantity), Discount Applied)); name of customer refers to Customer Names
|
SELECT `Customer Names` FROM ( SELECT T1.`Customer Names` , REPLACE(T2.`Unit Price`, ',', '') * T2.`Order Quantity` - REPLACE(T2.`Unit Price`, ',', '') * T2.`Discount Applied` AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY T DESC LIMIT 3
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Which sales channel was most preferred in commercializing products in January 2020 based on the number of orders placed?
|
order refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'; January refers to Substr(OrderDate, 1, 1) = '1'; most preferred sales channel refers to Sales Channel where Max(Count(OrderNumber))
|
SELECT `Sales Channel` FROM `Sales Orders` WHERE OrderDate LIKE '1/%/20' GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Name the product that was registered in the sales order 'SO - 0005951'.
|
sales order 'SO - 0005951' refers to OrderNumber = 'SO - 0005951'; product refers to Product Name
|
SELECT T FROM ( SELECT DISTINCT CASE WHEN T2.OrderNumber = 'SO - 0005951' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID ) WHERE T IS NOT NULL
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Identify the store location and sales team who processed the sales order 'SO - 0001004'.
|
sales order 'SO - 0001004' refers to OrderNumber = 'SO - 0001004'; store location refers to City Name
|
SELECT T3.`Sales Team`, T1.`City Name` FROM `Store Locations` AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._StoreID = T1.StoreID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.OrderNumber = 'SO - 0001004'
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
Identify the top customer of the store located in Gilbert, Arizona based on net profit associated with the customer relationship in 2019.
|
"Gilbert" is the City Name; 'Arizona' is the name of State; customer relationship in 2019 refers to ProcuredDate LIKE '%/19'; top net profit refers to Max(Subtract(Unit Price, Unit Cost))
|
SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Gilbert' AND T2.ProcuredDate LIKE '%/%/19' ORDER BY REPLACE(T2.`Unit Price`, ',', '') - REPLACE(T2.`Unit Cost`, ',', '') DESC LIMIT 1
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
How many sales orders were processed by the store located in Chandler in 2020?
|
"Chandler" is the City Name; orders refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'
|
SELECT SUM(CASE WHEN T2.`City Name` = 'Chandler' AND T1.OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What is the average household income of Glendale?
|
"Glendale" is the City Name; Average household income refers to avg(Household Income)
|
SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale'
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
regional_sales
|
What was the best discount applied to sales orders in 2020?
|
sales orders in 2020 refers to Substr(OrderDate, -2) = '20'; best discount applied refers to Max(Discount Applied)
|
SELECT MAX(`Discount Applied`) FROM `Sales Orders` WHERE OrderDate LIKE '%/%/20'
|
database name:db_id regional_sales
Customers table Customers Cols: customer id dtype integer, customer names dtype text,
Products table Products Cols: product id dtype integer, product name dtype text,
Regions table Regions Cols: state code dtype text, State dtype text, Region dtype text,
Sales Team table Sales Team Cols: SalesTeam ID dtype integer, Sales Team dtype text, Region dtype text,
Store Locations table Store Locations Cols: Store ID dtype integer, City Name dtype text, County dtype text, State Code dtype text, State dtype text, Type dtype text, Latitude dtype real, Longitude dtype real, Area Code dtype integer, Population dtype integer, Household Income dtype integer, Median Income dtype integer, Land Area dtype integer, Water Area dtype integer, Time Zone dtype text,
Sales Orders table Sales Orders Cols: Order Number dtype text, Sales Channel dtype text, Warehouse Code dtype text, Procured Date dtype text, Order Date dtype text, Ship Date dtype text, Delivery Date dtype text, Currency Code dtype text, _Sales Team ID dtype integer, _Customer ID dtype integer, _Store ID dtype integer, _Product ID dtype integer, Order Quantity dtype integer, Discount Applied dtype real, Unit Price dtype text, Unit Cost dtype text,
|
european_football_1
|
What is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?
|
consecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';
|
SELECT COUNT(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Of all the divisions in the world, what percentage of them belong to England?
|
DIVIDE(COUNT(division where country = 'England'), COUNT(division)) as percentage;
|
SELECT CAST(COUNT(CASE WHEN country = 'England' THEN division ELSE NULL END) AS REAL) * 100 / COUNT(division) FROM divisions
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What percentage of games won, games lost and games drawn does Cittadella have as a home team in total?
|
Percentage of games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;
|
SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Of all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?
|
Caen refers to HomeTeam; which one refers to AwayTeam; the highest winning percentage = MAX(DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Caen', season = '2010')), COUNT(Div where HomeTeam = 'Caen', season = '2010')) as percentage;
|
SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What percentage of matches played on 2005/07/30 belong to the F1 division?
|
Division refers to Div; DIVIDE(COUNT(Div = 'F1', Date = '2005/07/30'), COUNT(Div, Date = '2005/07/30')) as percentage;
|
SELECT CAST(SUM(CASE WHEN Div = 'F1' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Div) FROM matchs WHERE Date = '2005-07-30'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What percentage of all tied games did the Sassuolo team play in?
|
tied games refer FTR = 'D'; DIVIDE(COUNT(Div where FTR = 'D', HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo'), COUNT(Div where HomeTeam = 'Sassuolo' or AwayTeam = 'Sassuolo')) as percentage;
|
SELECT CAST(SUM(CASE WHEN HomeTeam = 'Sassuolo' OR AwayTeam = 'Sassuolo' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(FTR) FROM matchs WHERE FTR = 'D'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the percentage whereby the away team scored 2 goals during the 2017 seasons?
|
scored 2 goals refers to FTAG = 2, which is short name for Final-time Away-team Goals; DIVIDE(COUNT(Div where season = 2017, FTAG = '2'), COUNT(Div where season = 2017)) as percentage;
|
SELECT CAST(SUM(CASE WHEN FTAG = 2 THEN 1 ELSE 0 END) / COUNT(FTAG) AS REAL) * 100 FROM matchs WHERE season = 2017
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the name of all the teams that played in the EFL League One division?
|
all the teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';
|
SELECT T1.HomeTeam,T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'EFL League One' and T1.Div = 'E2'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many teams playing in divisions in Greece have ever scored 4 or more goals?
|
teams include both HomeTeam and AwayTeam; country = 'Greece'; scored 4 or more goals refer to FTAG≥4, which is short name for Final-time Away-team Goals;
|
SELECT COUNT(DISTINCT CASE WHEN T1.FTHG >= 4 THEN HomeTeam ELSE NULL end) + COUNT(DISTINCT CASE WHEN T1.FTAG >= 4 THEN AwayTeam ELSE NULL end) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2?
|
matches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which 2 Scottish teams scored 10 goals playing as a local team and in which seasons?
|
local team refers to HomeTeam; Scottish means belong to the country = 'Scotland'; scored 10 goals refer to FTHG = 10, which is short name for Final-time Away-team Goals;
|
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Scotland' AND T1.FTHG = 10
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?
|
local team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017)) as percentage;
|
SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many teams that played in the 2012 season belong to any of the English divisions and what percentage play in each of the divisions?
|
matches = Div
|
SELECT ( SELECT COUNT(T1.Div) AS total FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS num , CASE WHEN 1 THEN T.result END AS percentage FROM ( SELECT 100.0 * COUNT(T1.Div) / ( SELECT COUNT(T1.Div) FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS result FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 GROUP BY T2.division ) AS T
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the highest final-time score across all divisions in the 2021 season? Which team was the team that made up that score?
|
MAX(SUM where FTHG, FTAG, season = 2021);
|
SELECT ( SELECT MAX(MAX(FTAG), MAX(FTHG)) FROM matchs WHERE season = 2021 ) AS T1, AwayTeam FROM matchs WHERE season = 2021 AND FTHG = T1 OR FTAG = T1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the name of the home team in division P1 with the highest final time goal in all seasons?
|
the highest final time goal refers to MAX(FTHG); P1 = Div;
|
SELECT HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What was the difference in home team and away team win percentages across all divisions in 2010?
|
2010 refers to season = 2010; SUBTRACT(DIVIDE(COUNT(Div where FTR = 'H', season = 2010), COUNT(Div where season = 2010)), COUNT(Div where FTR = 'A', season = 2010), COUNT(Div where season = 2010)) as percentage;
|
SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) - CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) DIFFERENCE FROM matchs WHERE season = 2010
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which division had the most draft matches in the 2008 season?
|
the most draft matches refer to MAX(COUNT(Div)) where FTR = 'D';
|
SELECT Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team won the match in the EC division on January 20, 2008 at home?
|
won at home refers to FTR = 'H'; January 20, 2008 refers to Date = '2008-01-20'; EC division refers to Div = 'EC';
|
SELECT HomeTeam FROM matchs WHERE Div = 'EC' AND Date = '2008-01-20' AND FTR = 'H'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the name of the division in which Club Brugge and Genk competed on September 13, 2009?
|
September 13, 2009 refers to Date = '2009-09-13'; Club Brugge refers to HomeTeam; Genk refers to AwayTeam;
|
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2009-09-13' and T1.HomeTeam = 'Club Brugge' AND T1.AwayTeam = 'Genk'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many matches were played in the Scottish Premiership division from 2006 to 2008?
|
Scottish Premiership is a name of division; from 2006 to 2008 means seasons between 2006 and 2008;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish Premiership' AND (T1.season BETWEEN 2006 AND 2008)
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
In which division was the match between Hibernian, the away team, and Hearts, the home team, played? To which country does this division belong?
|
FALSE;
|
SELECT DISTINCT T2.division,T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.HomeTeam = 'Hearts' AND T1.AwayTeam = 'Hibernian'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which away team in the division of Bundesliga has the highest final time goals?
|
Bundesliga is a name of division; the highest final time goals refers to MAX(FTAG);
|
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'Bundesliga' ORDER BY T1.FTAG DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Please provide the names of any three away teams that competed in the Italian divisions.
|
Italian means belong to country = 'Italy";
|
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.country = 'Italy' LIMIT 3
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What is the name of the division that has had the lowest number of draft matches in the 2019 season?
|
the lowest number of draft matches refers to MIN(COUNT(FTR = 'D'));
|
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T1.FTR = 'D' GROUP BY T2.division ORDER BY COUNT(FTR) LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many times did Valencia's home team win in the LaLiga division?
|
LaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';
|
SELECT COUNT(T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T1.HomeTeam = 'Valencia' AND T1.FTR = 'H'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
In how many matches in the Seria A division did both teams have equal goals?
|
Seria A is a name of division; equal goals refers to FTR = 'D', where D stands for draft;
|
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Seria A' AND T1.FTR = 'D'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many football divisions does England have?
|
England is the name of country;
|
SELECT COUNT(division) FROM divisions WHERE country = 'England'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What's the name of the football division in the Netherlands?
|
Netherlands is the name of country;
|
SELECT name FROM divisions WHERE country = 'Netherlands'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Who is the winner of the game happened on 2009/10/10, between "East Fife" and "Dumbarton"?
|
2009/10/10 is a date; the winner refers to FTR = 'A'; East Fife and Dumbarton are name of teams where HomeTeam = 'East Fife'; AwayTeam = 'Dumbarton';
|
SELECT CASE WHEN FTR = 'H' THEN 'East Fife' ELSE 'Dumbarton' END WINNER FROM matchs WHERE Date = '2009-10-10' AND HomeTeam = 'East Fife' AND AwayTeam = 'Dumbarton'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What was the final score for the game Bursaspor vs Denizlispor on 2009/4/26?
|
Bursaspor vs Denizlispor are names of teams where HomeTeam = 'Bursaspor' and AwayTeam = 'Denizlispor'; Date = '2009-04-26'; final score refers to FTHG, FTAG;
|
SELECT FTHG, FTAG FROM matchs WHERE Date = '2009-04-26' AND HomeTeam = 'Bursaspor' AND AwayTeam = 'Denizlispor'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
When did the first match that score more than 10 goals happen?
|
score more than 10 goals refers to SUM(FTHG, FTAG)>10, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; the first means the earliest and refers to MIN(Date);
|
SELECT MIN(Date) FROM matchs WHERE FTHG + FTAG > 10
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
For the Ligue 2 game that made the most goals, who is the winner of that game?
|
Ligue 2 is the name of division; the most goals refer to MAX(SUM(FTHG, FTAG)) which are short names for Final-time Home-team Goals and Final-time Away-team Goals; winner refers to FTR = 'A';
|
SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam ELSE T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Ligue 2' ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many Away Victories happened on 2016/3/27 in the LaLiga 2 division?
|
Away victories refer to FTR = 'A'; LaLiga 2 is the name of division; Date = '2016-03-27';
|
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga 2' AND T1.Date = '2016-03-27' AND T1.FTR = 'A'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many draw games happened on 2018/8/7 for National League?
|
National League is the name of division; Date = '2018-08-07'; draw refers to FTR = 'D'; games refer to Div;
|
SELECT COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'National League' AND T1.Date = '2018-08-07' AND T1.FTR = 'D'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which country had the game that Away team made the most goals?
|
the most goals refer to MAX(FTAG), which is a short name for Final-time Away-team Goals;
|
SELECT T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division GROUP BY T2.country ORDER BY SUM(T1.FTAG) DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
For a game had a score of 1-8 in the year of 2011, what division was that game in? Give the full name of the division.
|
2011 refers to season; a score of 1-8 refers to FTHG = '1' and FTAG = '8';
|
SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2011 AND T1.FTHG = 1 AND T1.FTAG = 8
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which division had the most games with more than 5 total field goals on 2020/2/22? Give the full name of the division?
|
more than 5 total field goals refers to SUM(FTHG, FTAG)>5, which are short names for Final-time Home-team Goals and Final-time Away-team Goals; 2020/2/22 is a date;
|
SELECT T2.division, T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-02-22' AND T1.FTAG + T1.FTHG > 5 ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Give the full name of the divison that had the most 0-0 games.
|
the most 0-0 games means a no-score draw and refers to MAX(COUNT(Div where FTHG = '0' and FTAG = '0'));
|
SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.FTAG = 0 AND T1.FTHG = 0 GROUP BY T2.division ORDER BY COUNT(T1.FTAG) DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many Scottish League One games took place on the day that "Pro Vercelli" and "Pescara"had a 5-2 game?
|
Pro Vercelli and Pescara are names of teams; HomeTeam = 'Pro Vercelli'; AwayTeam = 'Pescara'; 5-2 is a score where FTHG = '5' and FTAG = '2'; Scottish League One is a name of division; games refer to Div;
|
SELECT COUNT(T1.Date) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish League One' AND T1.Date = ( SELECT Date FROM matchs WHERE FTHG = 5 AND FTAG = 2 AND HomeTeam = 'Pro Vercelli' AND AwayTeam = 'Pescara' )
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
List the number of games that ended up with 5-0 in Greece.
|
5-0 is a score where FTHG = '5' and FTAG = '0'; Greece is a name of country; games refer to Div;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece' AND T1.FTHG = 5 AND T1.FTAG = 0
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which country did Bradford Team belongs to?
|
Bradford team refers to HomeTeam = 'Bradford' or AwayTeam = 'Bradford';
|
SELECT DISTINCT T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.HomeTeam = 'Bradford' OR T1.AwayTeam = 'Bradford'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many Eredivisie teams have played in 2008?
|
Eredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;
|
SELECT COUNT(DISTINCT T1.HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Eredivisie' AND T1.season = 2008
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What's the home win ratio of the Bundesliga division in 2021?
|
home win refers to FTR = 'H', where H stands for home victory; season = '2021'; Bundesliga is a name of division; DIVIDE(COUNT(Div where FTR = 'H, season = '2021' and name = 'Bundesliga'), COUNT(Div where season = '2021' and name = 'Bundesliga')) as percentage;
|
SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Bundesliga'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
For all the games ended up with 1-1, what percentage of them are from Liga NOS division?
|
1-1 is a score where FTHG = '1' and FTAG = '1'; Liga NOS is the name of division; DIVIDE(COUNT(Div where FTHG = '1', FTAG = '1', name = 'Liga NOS'), COUNT(Div where FTHG = '1' and FTAG = '1')) as percentage;
|
SELECT CAST(COUNT(CASE WHEN T2.name = 'Liga NOS' THEN T1.Div ELSE NULL END) AS REAL) * 100 / COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.FTHG = 1 AND FTAG = 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many matches were held during the 2021 season's Premier League?
|
Premier League is the name of division;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Premier League'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team was the home team in the match of the Bundesliga division on 2020/10/2?
|
Bundesliga is the name of division; Date = '2020/10/2';
|
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team won the match of the Bundesliga division on 2020/10/2?
|
Bundesliga is the name of division; Date = '2020/10/2'; won the match refers to FTR = 'H';
|
SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam WHEN T1.FTR = 'A' THEN T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2020-10-02' AND T2.name = 'Bundesliga'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team has the most victories as the home team in matches of the Bundesliga division?
|
Bundesliga is the name of division; the most victories as the home team refers to MAX(COUNT(FTR = 'H'));
|
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'H' GROUP BY T1.HomeTeam ORDER BY COUNT(T1.FTR) DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many times did the team Werder Bremen win as the away team in matches of the Bundesliga division?
|
Bundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' AND T1.FTR = 'A'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many matches of the Bundesliga division ended with an away victory in the 2021 season?
|
Bundesliga is the name of division; away victory refers to FTR = 'A', where 'A' stands for away victory;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'A' AND T1.season = 2021
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Of the matches in all seasons of the Bundesliga division, how many of them ended with a tie?
|
Bundesliga is the name of division; tie refers to FTR = 'D', where D stands for draft;
|
SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.FTR = 'D'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many home victories does the Bundesliga division have in more or less than the Premier League division in the 2021 season?
|
Bundesliga and the Premier League are names of division; home victories refer to FTR = 'H', where H stands for home victory; SUBTRACT(COUNT(FTR = 'H' where season = 2021, name = 'Bundesliga'), COUNT(FTR = 'H' where season = 2021, name = 'Premier League'));
|
SELECT COUNT(CASE WHEN T2.name = 'Bundesliga' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.name = 'Premier League' THEN 1 ELSE NULL END) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Please list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season.
|
Bundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory;
|
SELECT DISTINCT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' AND T2.name = 'Bundesliga'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz?
|
Bundesliga is the name of division; more home victories refer to MAX(FTR = 'H)'; Augsburg and Mainz are names of teams and refer to HomeTeam;
|
SELECT CASE WHEN COUNT(CASE WHEN T1.HomeTeam = 'Augsburg' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.HomeTeam = ' Mainz' THEN 1 ELSE NULL END) > 0 THEN 'Augsburg' ELSE 'Mainz' END FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
Which team had the most final-time home-team goals in the 2021 season's matches of the Bundesliga division?
|
Bundesliga is the name of division; the most final-time home-team goals refers to MAX(FTHG);
|
SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.season = 2021 ORDER BY T1.FTHG DESC LIMIT 1
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
How many final-time home-team goals were there in total in all the matches of the Bundesliga division in the 2021 season?
|
Bundesliga is the name of division; final-time home-team goals refers to FTHG;
|
SELECT SUM(T1.FTHG) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.season = 2021
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
european_football_1
|
What's the winning rate of Club Brugge in the 2021 Premier League?
|
Premier League is name of division; season = 2021; Club Brugge is name of team; Club Brugge wins implies HomeTeam = 'Club Brugge' and FTR = 'H' and AwayTeam = 'Club Brugge' and FTR = 'A'; DIVIDE(SUM(COUNT(FTR = 'H' where HomeTeam = 'Club Brugge', name = 'Premier League', season = 2021), COUNT(FTR = 'A'where AwayTeam = 'Club Brugge', name = 'Premier League', season = 2021)), COUNT(Div where name = 'Premier League', season = 2021));
|
SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) + COUNT(CASE WHEN T1.FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(t1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.AwayTeam = 'Club Brugge' OR T1.HomeTeam = 'Club Brugge'
|
database name:db_id european_football_1
divisions table divisions Cols: division dtype text, name dtype text, country dtype text,
matchs table matchs Cols: Division dtype text, Date dtype date, HomeTeam dtype text, AwayTeam dtype text, Final-time Home-team Goals dtype integer, Final-time Away-team Goals dtype integer, Final-time Results dtype text, season dtype integer,
|
professional_basketball
|
Among the winning game from the team, what is the percentage of the winning was home game.
|
percentage of winning at the home = Divide(homeWon, won) * 100
|
SELECT CAST(homeWon AS REAL) * 100 / won FROM teams
|
database name:db_id professional_basketball
awards_players table awards_players Cols: playerID dtype text, award dtype text, year dtype integer, league ID dtype text, note dtype text, position dtype text,
coaches table coaches Cols: coachID dtype text, year dtype integer, team ID dtype text, league ID dtype text, stint dtype integer, won dtype integer, lost dtype integer, post season wins dtype integer, post season losses dtype integer,
draft table draft Cols: id dtype integer, draftYear dtype integer, draftRound dtype integer, league ID dtype integer, draft overall rank dtype integer, team ID dtype text, firstName dtype text, lastName dtype text, suffixName dtype text, playerID dtype text, draftFrom dtype text, league ID dtype text,
player_allstar table player_allstar Cols: playerID dtype text, last_name dtype text, first_name dtype text, season_id dtype integer, conference dtype text, league ID dtype text, games_played dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal_fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer,
players table players Cols: playerID dtype text, use first name dtype text, firstName dtype text, middleName dtype text, lastName dtype text, nameGiven dtype text, fullGivenName dtype text, nameSuffix dtype text, nick name dtype text, position dtype text, firstseason dtype integer, lastseason dtype integer, height dtype real, weight dtype integer, college dtype text, collegeOther dtype text, birthDate dtype date, birthCity dtype text, birthState dtype text, birthCountry dtype text, highSchool dtype text, high school city dtype text, high school state dtype text, high school country dtype text, deathDate dtype date, race dtype text,
teams table teams Cols: year dtype integer, league ID dtype text, team ID dtype text, franchID dtype text, confID dtype text, division ID dtype text, rank dtype integer, confRank dtype integer, playoff dtype text, name dtype text, offense field goal made dtype integer, offense free throw made dtype integer, offense points dtype integer, defense points dtype integer, home wins dtype integer, home loses dtype integer, away wins dtype integer, away loses dtype integer, won dtype integer, lost dtype integer, games dtype integer, arena dtype text,
awards_coaches table awards_coaches Cols: id dtype integer, year dtype integer, coachID dtype text, award dtype text, league ID dtype text, note dtype text,
players_teams table players_teams Cols: id dtype integer, playerID dtype text, year dtype integer, stint dtype integer, team ID dtype text, lgID dtype text, game presentatons dtype integer, game starting dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer, post season game presentations dtype integer, post season game starting dtype integer, post season minutes dtype integer, post season points dtype integer, post season offense rebounds dtype integer, post season defense rebounds dtype integer, post season defense rebounds dtype integer, post season assistants dtype integer, post season steals dtype integer, post season blocks dtype integer, post season turnovers dtype integer, post season personal fouls dtype integer, post season field goal attempted dtype integer, post season field goal made dtype integer, post season field free throw attempted dtype integer, post season free throw made dtype integer, post season three point attempted dtype integer, post season three point made dtype integer, note dtype text,
series_post table series_post Cols: id dtype integer, year dtype integer, round dtype text, series dtype text, team id winner dtype text, league id winner dtype text, team id loser dtype text, league id loser dtype text, wins dtype integer, loses dtype integer,
|
professional_basketball
|
Which team(s) has greater than 75% lost among all the games played.
|
greater than 75% lost refers to Divide(lost, games) > 0.75; team refers to tmID
|
SELECT name FROM teams WHERE CAST(lost AS REAL) * 100 / games > 75
|
database name:db_id professional_basketball
awards_players table awards_players Cols: playerID dtype text, award dtype text, year dtype integer, league ID dtype text, note dtype text, position dtype text,
coaches table coaches Cols: coachID dtype text, year dtype integer, team ID dtype text, league ID dtype text, stint dtype integer, won dtype integer, lost dtype integer, post season wins dtype integer, post season losses dtype integer,
draft table draft Cols: id dtype integer, draftYear dtype integer, draftRound dtype integer, league ID dtype integer, draft overall rank dtype integer, team ID dtype text, firstName dtype text, lastName dtype text, suffixName dtype text, playerID dtype text, draftFrom dtype text, league ID dtype text,
player_allstar table player_allstar Cols: playerID dtype text, last_name dtype text, first_name dtype text, season_id dtype integer, conference dtype text, league ID dtype text, games_played dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal_fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer,
players table players Cols: playerID dtype text, use first name dtype text, firstName dtype text, middleName dtype text, lastName dtype text, nameGiven dtype text, fullGivenName dtype text, nameSuffix dtype text, nick name dtype text, position dtype text, firstseason dtype integer, lastseason dtype integer, height dtype real, weight dtype integer, college dtype text, collegeOther dtype text, birthDate dtype date, birthCity dtype text, birthState dtype text, birthCountry dtype text, highSchool dtype text, high school city dtype text, high school state dtype text, high school country dtype text, deathDate dtype date, race dtype text,
teams table teams Cols: year dtype integer, league ID dtype text, team ID dtype text, franchID dtype text, confID dtype text, division ID dtype text, rank dtype integer, confRank dtype integer, playoff dtype text, name dtype text, offense field goal made dtype integer, offense free throw made dtype integer, offense points dtype integer, defense points dtype integer, home wins dtype integer, home loses dtype integer, away wins dtype integer, away loses dtype integer, won dtype integer, lost dtype integer, games dtype integer, arena dtype text,
awards_coaches table awards_coaches Cols: id dtype integer, year dtype integer, coachID dtype text, award dtype text, league ID dtype text, note dtype text,
players_teams table players_teams Cols: id dtype integer, playerID dtype text, year dtype integer, stint dtype integer, team ID dtype text, lgID dtype text, game presentatons dtype integer, game starting dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer, post season game presentations dtype integer, post season game starting dtype integer, post season minutes dtype integer, post season points dtype integer, post season offense rebounds dtype integer, post season defense rebounds dtype integer, post season defense rebounds dtype integer, post season assistants dtype integer, post season steals dtype integer, post season blocks dtype integer, post season turnovers dtype integer, post season personal fouls dtype integer, post season field goal attempted dtype integer, post season field goal made dtype integer, post season field free throw attempted dtype integer, post season free throw made dtype integer, post season three point attempted dtype integer, post season three point made dtype integer, note dtype text,
series_post table series_post Cols: id dtype integer, year dtype integer, round dtype text, series dtype text, team id winner dtype text, league id winner dtype text, team id loser dtype text, league id loser dtype text, wins dtype integer, loses dtype integer,
|
professional_basketball
|
List the team name and the total wins of the team in year 2005 which has greater winning from the previous year.
|
2005 refers to year = 2005 ; previous year refers to year = 2004; team with greater winning than previous year refers to Won where year = 2005 > Won where year = 2004; team name refers to tmID
|
SELECT T1.name, T1.won FROM teams AS T1 INNER JOIN ( SELECT * FROM teams WHERE year = 2004 ) AS T2 on T1.tmID = T2.tmID WHERE T1.year = 2005 and T1.won > T2.won
|
database name:db_id professional_basketball
awards_players table awards_players Cols: playerID dtype text, award dtype text, year dtype integer, league ID dtype text, note dtype text, position dtype text,
coaches table coaches Cols: coachID dtype text, year dtype integer, team ID dtype text, league ID dtype text, stint dtype integer, won dtype integer, lost dtype integer, post season wins dtype integer, post season losses dtype integer,
draft table draft Cols: id dtype integer, draftYear dtype integer, draftRound dtype integer, league ID dtype integer, draft overall rank dtype integer, team ID dtype text, firstName dtype text, lastName dtype text, suffixName dtype text, playerID dtype text, draftFrom dtype text, league ID dtype text,
player_allstar table player_allstar Cols: playerID dtype text, last_name dtype text, first_name dtype text, season_id dtype integer, conference dtype text, league ID dtype text, games_played dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal_fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer,
players table players Cols: playerID dtype text, use first name dtype text, firstName dtype text, middleName dtype text, lastName dtype text, nameGiven dtype text, fullGivenName dtype text, nameSuffix dtype text, nick name dtype text, position dtype text, firstseason dtype integer, lastseason dtype integer, height dtype real, weight dtype integer, college dtype text, collegeOther dtype text, birthDate dtype date, birthCity dtype text, birthState dtype text, birthCountry dtype text, highSchool dtype text, high school city dtype text, high school state dtype text, high school country dtype text, deathDate dtype date, race dtype text,
teams table teams Cols: year dtype integer, league ID dtype text, team ID dtype text, franchID dtype text, confID dtype text, division ID dtype text, rank dtype integer, confRank dtype integer, playoff dtype text, name dtype text, offense field goal made dtype integer, offense free throw made dtype integer, offense points dtype integer, defense points dtype integer, home wins dtype integer, home loses dtype integer, away wins dtype integer, away loses dtype integer, won dtype integer, lost dtype integer, games dtype integer, arena dtype text,
awards_coaches table awards_coaches Cols: id dtype integer, year dtype integer, coachID dtype text, award dtype text, league ID dtype text, note dtype text,
players_teams table players_teams Cols: id dtype integer, playerID dtype text, year dtype integer, stint dtype integer, team ID dtype text, lgID dtype text, game presentatons dtype integer, game starting dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer, post season game presentations dtype integer, post season game starting dtype integer, post season minutes dtype integer, post season points dtype integer, post season offense rebounds dtype integer, post season defense rebounds dtype integer, post season defense rebounds dtype integer, post season assistants dtype integer, post season steals dtype integer, post season blocks dtype integer, post season turnovers dtype integer, post season personal fouls dtype integer, post season field goal attempted dtype integer, post season field goal made dtype integer, post season field free throw attempted dtype integer, post season free throw made dtype integer, post season three point attempted dtype integer, post season three point made dtype integer, note dtype text,
series_post table series_post Cols: id dtype integer, year dtype integer, round dtype text, series dtype text, team id winner dtype text, league id winner dtype text, team id loser dtype text, league id loser dtype text, wins dtype integer, loses dtype integer,
|
professional_basketball
|
For team who has more home won than home lost more than 80%, list the team name and the offense points.
|
home won than home lost more than 80% refers to Divide(Subtract(homeWon, homeLost), games) > 0.8; offense point refers to o_fgm
|
SELECT name, o_pts FROM teams WHERE CAST((homeWon - homeLost) AS REAL) * 100 / games > 80
|
database name:db_id professional_basketball
awards_players table awards_players Cols: playerID dtype text, award dtype text, year dtype integer, league ID dtype text, note dtype text, position dtype text,
coaches table coaches Cols: coachID dtype text, year dtype integer, team ID dtype text, league ID dtype text, stint dtype integer, won dtype integer, lost dtype integer, post season wins dtype integer, post season losses dtype integer,
draft table draft Cols: id dtype integer, draftYear dtype integer, draftRound dtype integer, league ID dtype integer, draft overall rank dtype integer, team ID dtype text, firstName dtype text, lastName dtype text, suffixName dtype text, playerID dtype text, draftFrom dtype text, league ID dtype text,
player_allstar table player_allstar Cols: playerID dtype text, last_name dtype text, first_name dtype text, season_id dtype integer, conference dtype text, league ID dtype text, games_played dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal_fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer,
players table players Cols: playerID dtype text, use first name dtype text, firstName dtype text, middleName dtype text, lastName dtype text, nameGiven dtype text, fullGivenName dtype text, nameSuffix dtype text, nick name dtype text, position dtype text, firstseason dtype integer, lastseason dtype integer, height dtype real, weight dtype integer, college dtype text, collegeOther dtype text, birthDate dtype date, birthCity dtype text, birthState dtype text, birthCountry dtype text, highSchool dtype text, high school city dtype text, high school state dtype text, high school country dtype text, deathDate dtype date, race dtype text,
teams table teams Cols: year dtype integer, league ID dtype text, team ID dtype text, franchID dtype text, confID dtype text, division ID dtype text, rank dtype integer, confRank dtype integer, playoff dtype text, name dtype text, offense field goal made dtype integer, offense free throw made dtype integer, offense points dtype integer, defense points dtype integer, home wins dtype integer, home loses dtype integer, away wins dtype integer, away loses dtype integer, won dtype integer, lost dtype integer, games dtype integer, arena dtype text,
awards_coaches table awards_coaches Cols: id dtype integer, year dtype integer, coachID dtype text, award dtype text, league ID dtype text, note dtype text,
players_teams table players_teams Cols: id dtype integer, playerID dtype text, year dtype integer, stint dtype integer, team ID dtype text, lgID dtype text, game presentatons dtype integer, game starting dtype integer, minutes dtype integer, points dtype integer, offense rebounds dtype integer, defense rebounds dtype integer, rebounds dtype integer, assistants dtype integer, steals dtype integer, blocks dtype integer, turnovers dtype integer, personal fouls dtype integer, field goal attempted dtype integer, field goal made dtype integer, free throw attempted dtype integer, free throw made dtype integer, three point attempted dtype integer, three point made dtype integer, post season game presentations dtype integer, post season game starting dtype integer, post season minutes dtype integer, post season points dtype integer, post season offense rebounds dtype integer, post season defense rebounds dtype integer, post season defense rebounds dtype integer, post season assistants dtype integer, post season steals dtype integer, post season blocks dtype integer, post season turnovers dtype integer, post season personal fouls dtype integer, post season field goal attempted dtype integer, post season field goal made dtype integer, post season field free throw attempted dtype integer, post season free throw made dtype integer, post season three point attempted dtype integer, post season three point made dtype integer, note dtype text,
series_post table series_post Cols: id dtype integer, year dtype integer, round dtype text, series dtype text, team id winner dtype text, league id winner dtype text, team id loser dtype text, league id loser dtype text, wins dtype integer, loses dtype integer,
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.