db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How many sales teams are there in the Midwest?
SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
"Midwest" is the Region
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Indicate order numbers with an order date after 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
order date after 1/1/2018 refers to OrderDate > '1/1/2018'
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How many sales channels does the sales team have in the Midwest?
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'
"Midwest" is the Region
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which sales team has the other with the highest 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 Pr...
highest unit price refers to Max(Unit Price)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which regions have online sales channels that have the most discounts?
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
most discount refers to Max(Discount Applied)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which Apollo Ltd customer's order number has the most expensive unit price, indicating the order date?
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
"Apollo Ltd" is the Customer Names; most expensive unit price refers to max(Unit Price)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Provide order number, warehouse code of customers Elorac, Corp.
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'
"Elorac, Corp" is the Customer Names
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Name of customers who have ordered Cocktail Glasses by online sales channel.
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
"Cocktail Glasses" is the Product Name; customer refers to Customer Names
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which store in Arizona has the most net profit?
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
"Arizona" is the name of State; most net profit = Max(Subtract( Unit Price, Unit Cost))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How much more is the Florida store's computer product unit price than the Texas store?
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` = 'Com...
"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')
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Among sales teams in Midwest region, which sales team has an order quantity greater than 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
order quantity greater than 5 refers to Order Quantity > 5
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Please indicate store id in the state of California that have been applied 20% discount in store.
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
"California" is the name of State; in store refers to Sales Channel = 'In-Store'; 20% discount refers to Discount Applied = '0.2'
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
List the name of the customer with the most number of order quantity from 2018 to 2020.
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
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
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Please indicate total order quantity of product Candles and calculate the percentage of such product among all the orders.
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 L...
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
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which region is Joshua Bennet located in?
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
"Joshua Bennett" is the name of Sales Team
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the store id of the store located in the most populous county?
SELECT CASE WHEN MAX(Population) THEN StoreID END FROM `Store Locations`
most populous country refers to Max(Population)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How many sales teams are there in the Midwest?
SELECT SUM(CASE WHEN Region = 'Midwest' THEN 1 ELSE 0 END) FROM `Sales Team`
"Midwest" is the Region
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the type of store located in the city with the highest amount of water area?
SELECT CASE WHEN MAX(`Water Area`) THEN Type END FROM `Store Locations`
type of store in City refers to Type = 'City'; highest amount of water area refers to Max(Water Area)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How many online orders were shipped during the month of June 2018?
SELECT SUM(IIF(ShipDate LIKE '6/%/18' AND `Sales Channel` = 'Online', 1, 0)) FROM `Sales Orders`
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'
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How much is the discount applied to the order with the highest 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
highest unit price refers to Max(Unit Price)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the name of the product with the highest net profit?
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
highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of product refers to Product Name
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
In the Northeast region, what is the average household income for each city located in the state with the highest number of stores?
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
average household income = Divide (Sum(Household Income), Count(City Name)); highest number of store refers to Max(Count(StoreID))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
In which region can you find the stores located in the state whose median income is no more than 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
median income no more than 30,000 refers to Median Income < 30,000
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
In the West, how many stores are there in the city whose land area is below 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
"West" is the Region; land area is below 20,000,000 refers to Land Area < 20,000,000
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the name of the customer who purchased the product with the highest net profiit?
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
highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of customer refers to Customer Names
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
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.
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
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))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
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?
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
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
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the detailed coordinates of the store where the product with the 4th highest profit were purchased from?
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
detailed coordinates refers to Latitude, Longitude; highest net profit = Max(Subtract(Unit Price, Unit Cost))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
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.
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
shipped refers to ShipDate; in 2020 refers to SUBSTR(ShipDate, -2) = '20'; highest amount of shipped orders refers to Max(Count(OrderNumber))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Between 2018 to 2020, what is the average amount of shipped orders per year under Carl Nguyen?
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 L...
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)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the amount of discount applied to the product with the highest net profit and what is the name of the said product?
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
highest net profit refers to Max(Subtract(Unit Price, Unit Cost)); name of product refers to Product Name
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What are the names of the top 3 customers who paid the highest amount of price per order after discount?
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
highest price per order after discount refers to Max(Subtract(Multiply (Unit Price, Order Quantity), Discount Applied)); name of customer refers to Customer Names
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Which sales channel was most preferred in commercializing products in January 2020 based on the number of orders placed?
SELECT `Sales Channel` FROM `Sales Orders` WHERE OrderDate LIKE '1/%/20' GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1
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))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Name the product that was registered in the sales order 'SO - 0005951'.
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
sales order 'SO - 0005951' refers to OrderNumber = 'SO - 0005951'; product refers to Product Name
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Identify the store location and sales team who processed the sales order 'SO - 0001004'.
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'
sales order 'SO - 0001004' refers to OrderNumber = 'SO - 0001004'; store location refers to City Name
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
Identify the top customer of the store located in Gilbert, Arizona based on net profit associated with the customer relationship in 2019.
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`, ',', ''...
"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))
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
How many sales orders were processed by the store located in Chandler in 2020?
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
"Chandler" is the City Name; orders refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What is the average household income of Glendale?
SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale'
"Glendale" is the City Name; Average household income refers to avg(Household Income)
regional_sales
CREATE TABLE Customers ( CustomerID INTEGER constraint Customers_pk primary key, "Customer Names" TEXT ); CREATE TABLE Products ( ProductID INTEGER constraint Products_pk primary key, "Product Name" TEXT ); CREATE TABLE Regions ( StateCode TEXT ...
【DB_ID】 regional_sales 【Schema】 # Table: main.Customers [ (CustomerID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Customer Names:TEXT, Examples: [Avon Corp, WakeFern , Elorac, Corp]) ] # Table: main.Products [ (ProductID:INTEGER, Primary Key, Examples: [1, 2, 3]), (Product Name:TEXT, Examples: [Cookware, Photo Frames,...
What was the best discount applied to sales orders in 2020?
SELECT MAX(`Discount Applied`) FROM `Sales Orders` WHERE OrderDate LIKE '%/%/20'
sales orders in 2020 refers to Substr(OrderDate, -2) = '20'; best discount applied refers to Max(Discount Applied)
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?
SELECT COUNT(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'
consecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Of all the divisions in the world, what percentage of them belong to England?
SELECT CAST(COUNT(CASE WHEN country = 'England' THEN division ELSE NULL END) AS REAL) * 100 / COUNT(division) FROM divisions
DIVIDE(COUNT(division where country = 'England'), COUNT(division)) as percentage;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What percentage of games won, games lost and games drawn does Cittadella have as a home team in total?
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'
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 ...
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Of all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?
SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What percentage of matches played on 2005/07/30 belong to the F1 division?
SELECT CAST(SUM(CASE WHEN Div = 'F1' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Div) FROM matchs WHERE Date = '2005-07-30'
Division refers to Div; DIVIDE(COUNT(Div = 'F1', Date = '2005/07/30'), COUNT(Div, Date = '2005/07/30')) as percentage;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What percentage of all tied games did the Sassuolo team play in?
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'
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the percentage whereby the away team scored 2 goals during the 2017 seasons?
SELECT CAST(SUM(CASE WHEN FTAG = 2 THEN 1 ELSE 0 END) / COUNT(FTAG) AS REAL) * 100 FROM matchs WHERE season = 2017
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the name of all the teams that played in the EFL League One division?
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'
all the teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many teams playing in divisions in Greece have ever scored 4 or more 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'
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-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
matches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which 2 Scottish teams scored 10 goals playing as a local team and in which seasons?
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
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what 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
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', ...
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
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?
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.divisio...
matches = Div
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the highest final-time score across all divisions in the 2021 season? Which team was the team that made up that score?
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
MAX(SUM where FTHG, FTAG, season = 2021);
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the name of the home team in division P1 with the highest final time goal in all seasons?
SELECT HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1
the highest final time goal refers to MAX(FTHG); P1 = Div;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What was the difference in home team and away team win percentages across all divisions in 2010?
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
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which division had the most draft matches in the 2008 season?
SELECT Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1
the most draft matches refer to MAX(COUNT(Div)) where FTR = 'D';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team won the match in the EC division on January 20, 2008 at home?
SELECT HomeTeam FROM matchs WHERE Div = 'EC' AND Date = '2008-01-20' AND FTR = 'H'
won at home refers to FTR = 'H'; January 20, 2008 refers to Date = '2008-01-20'; EC division refers to Div = 'EC';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the name of the division in which Club Brugge and Genk competed on September 13, 2009?
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'
September 13, 2009 refers to Date = '2009-09-13'; Club Brugge refers to HomeTeam; Genk refers to AwayTeam;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many matches were played in the Scottish Premiership division from 2006 to 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)
Scottish Premiership is a name of division; from 2006 to 2008 means seasons between 2006 and 2008;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
In which division was the match between Hibernian, the away team, and Hearts, the home team, played? To which country does this division belong?
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'
FALSE;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which away team in the division of Bundesliga has the highest final time goals?
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
Bundesliga is a name of division; the highest final time goals refers to MAX(FTAG);
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Please provide the names of any three away teams that competed in the Italian divisions.
SELECT T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.country = 'Italy' LIMIT 3
Italian means belong to country = 'Italy";
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What is the name of the division that has had the lowest number of draft matches in the 2019 season?
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
the lowest number of draft matches refers to MIN(COUNT(FTR = 'D'));
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many times did Valencia's home team win in the LaLiga division?
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'
LaLiga is a name of the division; Valencia's home team refers to HomeTeam = 'Valencia'; win refers to FTR = 'H';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
In how many matches in the Seria A division did both teams have equal goals?
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'
Seria A is a name of division; equal goals refers to FTR = 'D', where D stands for draft;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many football divisions does England have?
SELECT COUNT(division) FROM divisions WHERE country = 'England'
England is the name of country;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What's the name of the football division in the Netherlands?
SELECT name FROM divisions WHERE country = 'Netherlands'
Netherlands is the name of country;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Who is the winner of the game happened on 2009/10/10, between "East Fife" and "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'
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';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What was the final score for the game Bursaspor vs Denizlispor on 2009/4/26?
SELECT FTHG, FTAG FROM matchs WHERE Date = '2009-04-26' AND HomeTeam = 'Bursaspor' AND AwayTeam = 'Denizlispor'
Bursaspor vs Denizlispor are names of teams where HomeTeam = 'Bursaspor' and AwayTeam = 'Denizlispor'; Date = '2009-04-26'; final score refers to FTHG, FTAG;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
When did the first match that score more than 10 goals happen?
SELECT MIN(Date) FROM matchs WHERE FTHG + FTAG > 10
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);
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
For the Ligue 2 game that made the most goals, who is the winner of that game?
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
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';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many Away Victories happened on 2016/3/27 in the LaLiga 2 division?
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'
Away victories refer to FTR = 'A'; LaLiga 2 is the name of division; Date = '2016-03-27';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many draw games happened on 2018/8/7 for National League?
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'
National League is the name of division; Date = '2018-08-07'; draw refers to FTR = 'D'; games refer to Div;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which country had the game that Away team made the most 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
the most goals refer to MAX(FTAG), which is a short name for Final-time Away-team Goals;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
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.
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
2011 refers to season; a score of 1-8 refers to FTHG = '1' and FTAG = '8';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which division had the most games with more than 5 total field goals on 2020/2/22? Give the full name of the division?
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
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Give the full name of the divison that had the most 0-0 games.
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
the most 0-0 games means a no-score draw and refers to MAX(COUNT(Div where FTHG = '0' and FTAG = '0'));
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many Scottish League One games took place on the day that "Pro Vercelli" and "Pescara"had a 5-2 game?
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' )
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
List the number of games that ended up with 5-0 in Greece.
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
5-0 is a score where FTHG = '5' and FTAG = '0'; Greece is a name of country; games refer to Div;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which country did Bradford Team belongs to?
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'
Bradford team refers to HomeTeam = 'Bradford' or AwayTeam = 'Bradford';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many Eredivisie teams have played in 2008?
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
Eredivisie is the name of division; 2008 refers to season; teams refer to HomeTeam;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What's the home win ratio of the Bundesliga division in 2021?
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'
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
For all the games ended up with 1-1, what percentage of them are from Liga NOS division?
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
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many matches were held during the 2021 season's Premier League?
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'
Premier League is the name of division;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team was the home team in the match of the Bundesliga division on 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'
Bundesliga is the name of division; Date = '2020/10/2';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team won the match of the Bundesliga division on 2020/10/2?
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'
Bundesliga is the name of division; Date = '2020/10/2'; won the match refers to FTR = 'H';
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team has the most victories as the home team in matches of the Bundesliga division?
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
Bundesliga is the name of division; the most victories as the home team refers to MAX(COUNT(FTR = 'H'));
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many times did the team Werder Bremen win as the away team in matches of the Bundesliga division?
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'
Bundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many matches of the Bundesliga division ended with an away victory in the 2021 season?
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
Bundesliga is the name of division; away victory refers to FTR = 'A', where 'A' stands for away victory;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Of the matches in all seasons of the Bundesliga division, how many of them ended with a tie?
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'
Bundesliga is the name of division; tie refers to FTR = 'D', where D stands for draft;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many home victories does the Bundesliga division have in more or less than the Premier League division in the 2021 season?
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'
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'));
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Please list the home teams in the matches of the Bundesliga division that ended with a home victory in the 2021 season.
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'
Bundesliga is the name of division; home victory refers to refer to FTR = 'H', where H stands for home victory;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz?
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'
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;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
Which team had the most final-time home-team goals in the 2021 season's matches of the Bundesliga division?
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
Bundesliga is the name of division; the most final-time home-team goals refers to MAX(FTHG);
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
How many final-time home-team goals were there in total in all the matches of the Bundesliga division in the 2021 season?
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
Bundesliga is the name of division; final-time home-team goals refers to FTHG;
european_football_1
CREATE TABLE divisions ( division TEXT not null primary key, name TEXT, country TEXT ); CREATE TABLE matchs ( Div TEXT, Date DATE, HomeTeam TEXT, AwayTeam TEXT, FTHG INTEGER, FTAG INTEGER, FTR TEXT, season INTEGER, foreign key (Div) r...
【DB_ID】 european_football_1 【Schema】 # Table: main.divisions [ (division:TEXT, Primary Key, Examples: [B1, D1, D2]), (name:TEXT, Examples: [Division 1A, Bundesliga, 2. Bundesliga]), (country:TEXT, Examples: [Belgium, Deutschland, England]) ] # Table: main.matchs [ (Div:TEXT, Examples: [B1, D1, D2]), (Date:DATE, Example...
What's the winning rate of Club Brugge in the 2021 Premier League?
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'
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 = ...
professional_basketball
CREATE TABLE awards_players ( playerID TEXT not null, award TEXT not null, year INTEGER not null, lgID TEXT null, note TEXT null, pos TEXT null, primary key (playerID, year, award), foreign key (playerID) references players (playerID) on update ca...
【DB_ID】 professional_basketball 【Schema】 # Table: main.awards_coaches [ (id:INTEGER, Primary Key, Examples: [1, 2, 3]), (year:INTEGER, Examples: [1962, 1963, 1964]), (coachID:TEXT, Examples: [gallaha01, hannual01, auerbre01]), (award:TEXT, Examples: [NBA Coach of the Year]), (lgID:TEXT, Examples: [NBA, ABA]), (note:TEX...
Among the winning game from the team, what is the percentage of the winning was home game.
SELECT CAST(homeWon AS REAL) * 100 / won FROM teams
percentage of winning at the home = Divide(homeWon, won) * 100
professional_basketball
CREATE TABLE awards_players ( playerID TEXT not null, award TEXT not null, year INTEGER not null, lgID TEXT null, note TEXT null, pos TEXT null, primary key (playerID, year, award), foreign key (playerID) references players (playerID) on update ca...
【DB_ID】 professional_basketball 【Schema】 # Table: main.awards_coaches [ (id:INTEGER, Primary Key, Examples: [1, 2, 3]), (year:INTEGER, Examples: [1962, 1963, 1964]), (coachID:TEXT, Examples: [gallaha01, hannual01, auerbre01]), (award:TEXT, Examples: [NBA Coach of the Year]), (lgID:TEXT, Examples: [NBA, ABA]), (note:TEX...
Which team(s) has greater than 75% lost among all the games played.
SELECT name FROM teams WHERE CAST(lost AS REAL) * 100 / games > 75
greater than 75% lost refers to Divide(lost, games) > 0.75; team refers to tmID
professional_basketball
CREATE TABLE awards_players ( playerID TEXT not null, award TEXT not null, year INTEGER not null, lgID TEXT null, note TEXT null, pos TEXT null, primary key (playerID, year, award), foreign key (playerID) references players (playerID) on update ca...
【DB_ID】 professional_basketball 【Schema】 # Table: main.awards_coaches [ (id:INTEGER, Primary Key, Examples: [1, 2, 3]), (year:INTEGER, Examples: [1962, 1963, 1964]), (coachID:TEXT, Examples: [gallaha01, hannual01, auerbre01]), (award:TEXT, Examples: [NBA Coach of the Year]), (lgID:TEXT, Examples: [NBA, ABA]), (note:TEX...
List the team name and the total wins of the team in year 2005 which has greater winning from the previous year.
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
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
professional_basketball
CREATE TABLE awards_players ( playerID TEXT not null, award TEXT not null, year INTEGER not null, lgID TEXT null, note TEXT null, pos TEXT null, primary key (playerID, year, award), foreign key (playerID) references players (playerID) on update ca...
【DB_ID】 professional_basketball 【Schema】 # Table: main.awards_coaches [ (id:INTEGER, Primary Key, Examples: [1, 2, 3]), (year:INTEGER, Examples: [1962, 1963, 1964]), (coachID:TEXT, Examples: [gallaha01, hannual01, auerbre01]), (award:TEXT, Examples: [NBA Coach of the Year]), (lgID:TEXT, Examples: [NBA, ABA]), (note:TEX...
For team who has more home won than home lost more than 80%, list the team name and the offense points.
SELECT name, o_pts FROM teams WHERE CAST((homeWon - homeLost) AS REAL) * 100 / games > 80
home won than home lost more than 80% refers to Divide(Subtract(homeWon, homeLost), games) > 0.8; offense point refers to o_fgm