Chinastark/bird_dataset huggingface dataset:
Database: regional_sales
Question: Provide order number, warehouse code of customers Elorac, Corp.
Evidence: "Elorac, Corp" is the Customer Names
SQL: SELECT DISTINCT T1.OrderNumber, T1.WarehouseCode FROM `Sales Orders` AS T1 INNER JOIN Customers AS T2 ON T2.CustomerID = T1._CustomerID WHERE T2.`Customer Names` = 'Elorac, Corp'
Database: regional_sales
Question: Name of customers who have ordered Cocktail Glasses by online sales channel.
Evidence: "Cocktail Glasses" is the Product Name; customer refers to Customer Names
SQL: SELECT T FROM ( SELECT DISTINCT CASE  WHEN T3.`Product Name` = 'Cocktail Glasses' AND T2.`Sales Channel` = 'Online' THEN T1.`Customer Names` END AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID INNER JOIN Products T3 ON T3.ProductID = T2._ProductID ) WHERE T IS NOT NULL
Database: regional_sales
Question: Which store in Arizona has the most net profit?
Evidence: "Arizona" is the name of State; most net profit = Max(Subtract( Unit Price, Unit Cost))
SQL: SELECT T2.StoreID FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID WHERE T2.State = 'Arizona' ORDER BY T1.`Unit Price` - T1.`Unit Cost` DESC LIMIT 1
Database: regional_sales
Question: How much more is the Florida store's computer product unit price than the Texas store?
Evidence: "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')
SQL: SELECT SUM(CASE WHEN T3.State = 'Florida' THEN T2.`Unit Price` ELSE 0 END) - SUM(CASE WHEN T3.State = 'Texas' THEN T2.`Unit Price` ELSE 0 END) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T1.`Product Name` = 'Computers'
Database: regional_sales
Question: Among sales teams in Midwest region, which sales team has an order quantity greater than 5?
Evidence: order quantity greater than 5 refers to Order Quantity > 5
SQL: SELECT DISTINCT T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T2.Region = 'Midwest' AND T1.`Order Quantity` > 5
Database: regional_sales
Question: Please indicate store id in the state of California that have been applied 20% discount in store.
Evidence: "California" is the name of State; in store refers to Sales Channel = 'In-Store'; 20% discount refers to Discount Applied = '0.2'
SQL: SELECT T FROM ( SELECT DISTINCT CASE  WHEN T2.State = 'California' AND T1.`Sales Channel` = 'In-Store' AND T1.`Discount Applied` = 0.2 THEN T2.StoreID END AS T FROM `Sales Orders` T1 INNER JOIN `Store Locations` T2 ON T2.StoreID = T1._StoreID ) WHERE T IS NOT NULL
Database: regional_sales
Question: List the name of the customer with the most number of order quantity from 2018 to 2020.
Evidence: 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
SQL: SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID WHERE T2.OrderDate LIKE '%/%/18' OR T2.OrderDate LIKE '%/%/19' OR T2.OrderDate LIKE '%/%/20' ORDER BY T2.`Order Quantity` DESC LIMIT 1
Database: regional_sales
Question: Please indicate total order quantity of product Candles and calculate the percentage of such product among all the orders.
Evidence: 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
SQL: SELECT SUM(CASE WHEN T1.`Product Name` = 'Candles' THEN T2.`Order Quantity` ELSE 0 END), CAST(SUM(CASE WHEN T1.`Product Name` = 'Candles' THEN T2.`Order Quantity` ELSE 0 END) AS REAL) * 100 / SUM(T2.`Order Quantity`) FROM Products AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._ProductID = T1.ProductID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID
Database: regional_sales
Question: Which region is Joshua Bennet located in?
Evidence: "Joshua Bennett" is the name of Sales Team
SQL: SELECT T FROM ( SELECT DISTINCT CASE  WHEN `Sales Team` = 'Joshua Bennett' THEN Region ELSE NULL END AS T FROM `Sales Team` ) WHERE T IS NOT NULL
Database: regional_sales
Question: What is the store id of the store located in the most populous county?
Evidence: most populous country refers to Max(Population)
SQL: SELECT CASE WHEN MAX(Population) THEN StoreID END FROM `Store Locations`
Database: regional_sales
Question: What is the type of store located in the city with the highest amount of water area?
Evidence: type of store in City refers to Type = 'City'; highest amount of water area refers to Max(Water Area)
SQL: SELECT CASE WHEN MAX(`Water Area`) THEN Type END FROM `Store Locations`
Database: regional_sales
Question: How many online orders were shipped during the month of June 2018?
Evidence: 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'
SQL: SELECT SUM(IIF(ShipDate LIKE '6/%/18' AND `Sales Channel` = 'Online', 1, 0)) FROM `Sales Orders`
Database: regional_sales
Question: How much is the discount applied to the order with the highest unit price?
Evidence: highest unit price refers to Max(Unit Price)
SQL: SELECT `Discount Applied` FROM `Sales Orders` WHERE REPLACE(`Unit Price`, ',', '') = ( SELECT REPLACE(`Unit Price`, ',', '') FROM `Sales Orders` ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1 ) ORDER BY REPLACE(`Unit Price`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: What is the name of the product with the highest net profit?
Evidence: highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of product refers to Product Name
SQL: SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: In the Northeast region, what is the average household income for each city located in the state with the highest number of stores?
Evidence: average household income = Divide (Sum(Household Income), Count(City Name)); highest number of store refers to Max(Count(StoreID))
SQL: SELECT AVG(T2.`Household Income`) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode WHERE T1.Region = 'Northeast' GROUP BY T2.State ORDER BY COUNT(T2.StoreID) DESC LIMIT 1
Database: regional_sales
Question: In which region can you find the stores located in the state whose median income is no more than 30,000?
Evidence: median income no more than 30,000 refers to Median Income < 30,000
SQL: SELECT T FROM ( SELECT DISTINCT CASE  WHEN T2.`Median Income` < 30000 THEN T1.Region END AS T FROM Regions T1 INNER JOIN `Store Locations` T2 ON T2.StateCode = T1.StateCode ) WHERE T IS NOT NULL
Database: regional_sales
Question: In the West, how many stores are there in the city whose land area is below 20,000,000?
Evidence: "West" is the Region; land area is below 20,000,000 refers to Land Area < 20,000,000
SQL: SELECT SUM(CASE WHEN T1.Region = 'West' AND T2.`Land Area` < 20000000 THEN 1 ELSE 0 END) FROM Regions AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StateCode = T1.StateCode
Database: regional_sales
Question: What is the name of the customer who purchased the product with the highest net profiit?
Evidence: highest net profit = Max(Subtract (Unit Price, Unit Cost)); name of customer refers to Customer Names
SQL: SELECT `Customer Names` FROM ( SELECT T1.`Customer Names`, T2.`Unit Price` - T2.`Unit Cost` AS "net profit" FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY `net profit` DESC LIMIT 1
Database: regional_sales
Question: 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.
Evidence: 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))
SQL: SELECT COUNT(T1.OrderNumber), T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.OrderDate LIKE '%/%/19' AND T1.ShipDate LIKE '%/%/19' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
Database: regional_sales
Question: 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?
Evidence: 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
SQL: SELECT T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID WHERE T1.`Order Quantity` > 5 AND ShipDate LIKE '5/%/19' ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') ASC LIMIT 1
Database: regional_sales
Question: What is the detailed coordinates of the store where the product with the 4th highest profit were purchased from?
Evidence: detailed coordinates refers to Latitude, Longitude; highest net profit = Max(Subtract(Unit Price, Unit Cost))
SQL: SELECT T2.Latitude, T2.Longitude FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 3, 1
Database: regional_sales
Question: 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.
Evidence: shipped refers to ShipDate; in 2020 refers to SUBSTR(ShipDate, -2) = '20'; highest amount of shipped orders refers to Max(Count(OrderNumber))
SQL: SELECT COUNT(T1.OrderNumber), T2.`Sales Team` FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE T1.ShipDate LIKE '%/%/20' GROUP BY T2.`Sales Team` ORDER BY COUNT(T1.OrderNumber) DESC LIMIT 1
Database: regional_sales
Question: Between 2018 to 2020, what is the average amount of shipped orders per year under Carl Nguyen?
Evidence: 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)
SQL: SELECT CAST(COUNT(T1.OrderNumber) AS REAL) / 3 FROM `Sales Orders` AS T1 INNER JOIN `Sales Team` AS T2 ON T2.SalesTeamID = T1._SalesTeamID WHERE (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/18') OR (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/19') OR (T2.`Sales Team` = 'Carl Nguyen' AND ShipDate LIKE '%/%/20')
Database: regional_sales
Question: What is the amount of discount applied to the product with the highest net profit and what is the name of the said product?
Evidence: highest net profit refers to Max(Subtract(Unit Price, Unit Cost)); name of product refers to Product Name
SQL: SELECT T1.`Unit Price` * T1.`Discount Applied`, T2.`Product Name` FROM `Sales Orders` AS T1 INNER JOIN Products AS T2 ON T2.ProductID = T1._ProductID ORDER BY REPLACE(T1.`Unit Price`, ',', '') - REPLACE(T1.`Unit Cost`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: What are the names of the top 3 customers who paid the highest amount of price per order after discount?
Evidence: highest price per order after discount refers to Max(Subtract(Multiply (Unit Price, Order Quantity), Discount Applied)); name of customer refers to Customer Names
SQL: SELECT `Customer Names` FROM ( SELECT T1.`Customer Names` , REPLACE(T2.`Unit Price`, ',', '') * T2.`Order Quantity` - REPLACE(T2.`Unit Price`, ',', '') * T2.`Discount Applied` AS T FROM Customers T1 INNER JOIN `Sales Orders` T2 ON T2._CustomerID = T1.CustomerID ) ORDER BY T DESC LIMIT 3
Database: regional_sales
Question: Which sales channel was most preferred in commercializing products in January 2020 based on the number of orders placed?
Evidence: 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))
SQL: SELECT `Sales Channel` FROM `Sales Orders` WHERE OrderDate LIKE '1/%/20' GROUP BY `Sales Channel` ORDER BY COUNT(`Sales Channel`) DESC LIMIT 1
Database: regional_sales
Question: Name the product that was registered in the sales order 'SO - 0005951'.
Evidence: sales order 'SO - 0005951' refers to OrderNumber = 'SO - 0005951'; product refers to Product Name
SQL: SELECT T FROM ( SELECT DISTINCT CASE  WHEN T2.OrderNumber = 'SO - 0005951' THEN T1.`Product Name` ELSE NULL END AS T FROM Products T1 INNER JOIN `Sales Orders` T2 ON T2._ProductID = T1.ProductID ) WHERE T IS NOT NULL
Database: regional_sales
Question: Identify the store location and sales team who processed the sales order 'SO - 0001004'.
Evidence: sales order 'SO - 0001004' refers to OrderNumber = 'SO - 0001004'; store location refers to City Name
SQL: SELECT T3.`Sales Team`, T1.`City Name` FROM `Store Locations` AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._StoreID = T1.StoreID INNER JOIN `Sales Team` AS T3 ON T3.SalesTeamID = T2._SalesTeamID WHERE T2.OrderNumber = 'SO - 0001004'
Database: regional_sales
Question: Identify the top customer of the store located in Gilbert, Arizona based on net profit associated with the customer relationship in 2019.
Evidence: "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))
SQL: SELECT T1.`Customer Names` FROM Customers AS T1 INNER JOIN `Sales Orders` AS T2 ON T2._CustomerID = T1.CustomerID INNER JOIN `Store Locations` AS T3 ON T3.StoreID = T2._StoreID WHERE T3.`City Name` = 'Gilbert' AND T2.ProcuredDate LIKE '%/%/19' ORDER BY REPLACE(T2.`Unit Price`, ',', '') - REPLACE(T2.`Unit Cost`, ',', '') DESC LIMIT 1
Database: regional_sales
Question: How many sales orders were processed by the store located in Chandler in 2020?
Evidence: "Chandler" is the City Name; orders refers to OrderDate; in 2020 refers to Substr(OrderDate, -2) = '20'
SQL: SELECT SUM(CASE WHEN T2.`City Name` = 'Chandler' AND T1.OrderDate LIKE '%/%/20' THEN 1 ELSE 0 END) FROM `Sales Orders` AS T1 INNER JOIN `Store Locations` AS T2 ON T2.StoreID = T1._StoreID
Database: regional_sales
Question: What is the average household income of Glendale?
Evidence: "Glendale" is the City Name; Average household income refers to avg(Household Income)
SQL: SELECT AVG(`Household Income`) FROM `Store Locations` WHERE `City Name` = 'Glendale'
Database: regional_sales
Question: What was the best discount applied to sales orders in 2020?
Evidence: sales orders in 2020 refers to Substr(OrderDate, -2) = '20'; best discount applied refers to Max(Discount Applied)
SQL: SELECT MAX(`Discount Applied`) FROM `Sales Orders` WHERE OrderDate LIKE '%/%/20'
Database: european_football_1
Question: What is the most consecutive games tied by Ebbsfleet as an away team in the 2008 season?
Evidence: consecutive games mean happen one after the other without interruption and refer to Date; tied refers to FTR = 'D';
SQL: SELECT COUNT(*) FROM matchs WHERE season = 2008 AND AwayTeam = 'Ebbsfleet' AND FTR = 'D'
Database: european_football_1
Question: Of all the divisions in the world, what percentage of them belong to England?
Evidence: DIVIDE(COUNT(division where country = 'England'), COUNT(division)) as percentage;
SQL: SELECT CAST(COUNT(CASE WHEN country = 'England' THEN division ELSE NULL END) AS REAL) * 100 / COUNT(division) FROM divisions
Database: european_football_1
Question: What percentage of games won, games lost and games drawn does Cittadella have as a home team in total?
Evidence: Percentage of games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;

SQL: SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella'
Database: european_football_1
Question: Of all the teams that played as a team away against Caen in the 2010 season, which one has the highest winning percentage?
Evidence: 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;
SQL: SELECT AwayTeam FROM matchs WHERE HomeTeam = 'Caen' AND season = 2010 AND FTR = 'A' GROUP BY AwayTeam ORDER BY COUNT(AwayTeam) DESC LIMIT 1
Database: european_football_1
Question: What percentage of matches played on 2005/07/30 belong to the F1 division?
Evidence: Division refers to Div; DIVIDE(COUNT(Div = 'F1', Date = '2005/07/30'), COUNT(Div, Date = '2005/07/30')) as percentage;
SQL: SELECT CAST(SUM(CASE WHEN Div = 'F1' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Div) FROM matchs WHERE Date = '2005-07-30'
Database: european_football_1
Question: What percentage of all tied games did the Sassuolo team play in?
Evidence: 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;
SQL: SELECT CAST(SUM(CASE WHEN HomeTeam = 'Sassuolo' OR AwayTeam = 'Sassuolo' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(FTR) FROM matchs WHERE FTR = 'D'
Database: european_football_1
Question: What is the percentage whereby the away team scored 2 goals during the 2017 seasons?
Evidence: 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;
SQL: SELECT CAST(SUM(CASE WHEN FTAG = 2 THEN 1 ELSE 0 END) / COUNT(FTAG) AS REAL) * 100 FROM matchs WHERE season = 2017
Database: european_football_1
Question: What is the name of all the teams that played in the EFL League One division?
Evidence: all the teams include both HomeTeam and AwayTeam; name = 'EFL League One'; DIV = 'E2';
SQL: SELECT T1.HomeTeam,T1.AwayTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div=T2.division WHERE T2.name = 'EFL League One' and T1.Div = 'E2'
Database: european_football_1
Question: How many teams playing in divisions in Greece have ever scored 4 or more goals?
Evidence: 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;
SQL: SELECT COUNT(DISTINCT CASE WHEN T1.FTHG >= 4 THEN HomeTeam ELSE NULL end) + COUNT(DISTINCT CASE WHEN T1.FTAG >= 4 THEN AwayTeam ELSE NULL end) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece'
Database: european_football_1
Question: How many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2?
Evidence: matches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2;
SQL: SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2
Database: european_football_1
Question: Which 2 Scottish teams scored 10 goals playing as a local team and in which seasons?
Evidence: 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;
SQL: SELECT T1.HomeTeam FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Scotland' AND T1.FTHG = 10
Database: european_football_1
Question: From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?
Evidence: local team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017)) as percentage;
SQL: SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017
Database: european_football_1
Question: 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?
Evidence: matches = Div
SQL: SELECT ( SELECT COUNT(T1.Div) AS total FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS num , CASE WHEN 1 THEN T.result END AS percentage FROM ( SELECT 100.0 * COUNT(T1.Div) / ( SELECT COUNT(T1.Div) FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS result FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 GROUP BY T2.division ) AS T
Database: european_football_1
Question: What is the highest final-time score across all divisions in the 2021 season? Which team was the team that made up that score?
Evidence: MAX(SUM where FTHG, FTAG, season = 2021);
SQL: SELECT ( SELECT MAX(MAX(FTAG), MAX(FTHG)) FROM matchs WHERE season = 2021 ) AS T1, AwayTeam FROM matchs WHERE season = 2021 AND FTHG = T1 OR FTAG = T1
Database: european_football_1
Question: What is the name of the home team in division P1 with the highest final time goal in all seasons?
Evidence: the highest final time goal refers to MAX(FTHG); P1 = Div;
SQL: SELECT HomeTeam FROM matchs WHERE Div = 'P1' AND season = 2021 ORDER BY FTHG DESC LIMIT 1
Database: european_football_1
Question: What was the difference in home team and away team win percentages across all divisions in 2010?
Evidence: 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;
SQL: SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) - CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) DIFFERENCE FROM matchs WHERE season = 2010
Database: european_football_1
Question: Which division had the most draft matches in the 2008 season?
Evidence: the most draft matches refer to MAX(COUNT(Div)) where FTR = 'D';
SQL: SELECT Div FROM matchs WHERE season = 2008 AND FTR = 'D' GROUP BY Div ORDER BY COUNT(FTR) DESC LIMIT 1
Database: european_football_1
Question: Which team won the match in the EC division on January 20, 2008 at home?
Evidence: won at home refers to FTR = 'H'; January 20, 2008 refers to Date = '2008-01-20'; EC division refers to Div = 'EC';
SQL: SELECT HomeTeam FROM matchs WHERE Div = 'EC' AND Date = '2008-01-20' AND FTR = 'H'
Database: european_football_1
Question: What is the name of the division in which Club Brugge and Genk competed on September 13, 2009?
Evidence: September 13, 2009 refers to Date = '2009-09-13'; Club Brugge refers to HomeTeam; Genk refers to AwayTeam;
SQL: 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'