birdsql/bird_sql_dev_20251106 huggingface dataset:
Database: student_club
Question: List the full name of the top five members who spend the most money in the descending order of spending.
Evidence: full name refers to first_name, last_name; spend the most money refers to SUM(expense.cost) for each member
SQL:
SELECT T2.first_name, T2.last_name FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id GROUP BY T2.member_id, T2.first_name, T2.last_name ORDER BY SUM(T1.cost) DESC LIMIT 5
Database: student_club
Question: Give the full name and contact number of members who had to spend more than average on each expense.
Evidence: full name refers to first_name, last_name; contact number refers to phone; had spent more than average on each expense refers to cost > AVG(cost)
SQL:
SELECT DISTINCT T3.first_name, T3.last_name, T3.phone FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member WHERE T1.cost > ( SELECT AVG(T1.cost) FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id INNER JOIN member AS T3 ON T3.member_id = T1.link_to_member )
Database: student_club
Question: Calculate the difference in the percentage of members in New Jersey and Vermont.
Evidence: SUBTRACT( DIVIDE( SUM(state = 'New Jersey'), COUNT(position = 'Member')), DIVIDE( SUM(state = 'Vermont'), COUNT(position = 'Member')) )
SQL:
SELECT CAST((SUM(CASE WHEN T2.state = 'New Jersey' THEN 1 ELSE 0 END) - SUM(CASE WHEN T2.state = 'Vermont' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.member_id) AS diff FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip
Database: student_club
Question: What is the major of Garrett Gerke and which department does it belong to?
Evidence: major refers to major name;
SQL:
SELECT T2.major_name, T2.department FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.first_name = 'Garrett' AND T1.last_name = 'Gerke'
Database: student_club
Question: Write the full name of the member who spent money for water, veggie tray and supplies and include the cost of it.
Evidence: full name refers to first_name, last name; spent money for refers expense description; expense_description = 'Water, Veggie tray, supplies'
SQL:
SELECT T2.first_name, T2.last_name, T1.cost FROM expense AS T1 INNER JOIN member AS T2 ON T1.link_to_member = T2.member_id WHERE T1.expense_description = 'Water, Veggie tray, supplies'
Database: student_club
Question: List the last names of students under the Elementary Education major and include their phone numbers.
Evidence: 'Elementary Education' is the major name; phone numbers refers to phone
SQL:
SELECT T1.last_name, T1.phone FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T2.major_name = 'Elementary Education'
Database: student_club
Question: What category was budgeted for the 'January Speaker' event and how much was the amount budgeted for that category?
Evidence: amount budgeted refers to amount, 'January Speaker' is the event name;
SQL:
SELECT T2.category, T2.amount FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T1.event_name = 'January Speaker'
Database: student_club
Question: List the event names which were budgeted for the food.
Evidence: budgeted for food refers to category = 'Food'
SQL:
SELECT T1.event_name FROM event AS T1 INNER JOIN budget AS T2 ON T1.event_id = T2.link_to_event WHERE T2.category = 'Food'
Database: student_club
Question: Write the full names of students who received funds on the date of 9/9/2019 and include the amount received.
Evidence: full name refers to first_name, last_name, amount of funds received refers to amount, received funds on date refers to date_received
SQL:
SELECT DISTINCT T1.first_name, T1.last_name, T2.amount 
FROM member AS T1 
INNER JOIN income AS T2 ON T2.link_to_member = T1.member_id 
WHERE T2.date_received = '2019-09-09'
Database: student_club
Question: Which budget category does the expense 'Posters' fall to?
Evidence: 'Posters' refers to expense description
SQL:
SELECT DISTINCT T2.category FROM expense AS T1 INNER JOIN budget AS T2 ON T1.link_to_budget = T2.budget_id WHERE T1.expense_description = 'Posters'
Database: student_club
Question: Write the full name of the club member with the position of 'Secretary' and list which college the club member belongs to.
Evidence: full name refers to first_name, last name
SQL:
SELECT T1.first_name, T1.last_name, college FROM member AS T1 INNER JOIN major AS T2 ON T2.major_id = T1.link_to_major WHERE T1.position = 'Secretary'
Database: student_club
Question: Calculate the total amount spent on speaker gifts and list the name of the event they were spent on.
Evidence: total amount spent = SUM(spent) where category = 'Speaker Gifts'
SQL:
SELECT SUM(T1.spent), T2.event_name FROM budget AS T1 INNER JOIN event AS T2 ON T1.link_to_event = T2.event_id WHERE T1.category = 'Speaker Gifts' GROUP BY T2.event_name
Database: student_club
Question: Where is the hometown of Garrett Gerke?
Evidence: hometown refers to city
SQL:
SELECT T2.city FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip WHERE T1.first_name = 'Garrett' AND T1.last_name = 'Gerke'
Database: student_club
Question: Which student has the hometown of Lincolnton, North Carolina with the zip code of 28092? List their full name and position.
Evidence: full name refers to first_name, last_name, hometown of Lincolnton, North Carolina refers to city = 'Lincolnton' AND state = 'North Carolina'
SQL:
SELECT T1.first_name, T1.last_name, T1.position FROM member AS T1 INNER JOIN zip_code AS T2 ON T2.zip_code = T1.zip WHERE T2.city = 'Lincolnton' AND T2.state = 'North Carolina' AND T2.zip_code = 28092
Database: debit_card_specializing
Question: How many gas stations in CZE has Premium gas?
SQL:
SELECT COUNT(GasStationID) FROM gasstations WHERE Country = 'CZE' AND Segment = 'Premium'
Database: debit_card_specializing
Question: What is the ratio of customers who pay in EUR against customers who pay in CZK?
Evidence: ratio of customers who pay in EUR against customers who pay in CZK = count(Currency = 'EUR') / count(Currency = 'CZK').
SQL:
SELECT CAST(SUM(IIF(Currency = 'EUR', 1, 0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', 1, 0)) AS ratio FROM customers
Database: debit_card_specializing
Question: In 2012, who had the least consumption in LAM?
Evidence: Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year.
SQL:
SELECT T1.CustomerID 
FROM customers AS T1 
INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID 
WHERE T1.Segment = 'LAM' 
  AND SUBSTR(T2.Date, 1, 4) = '2012' 
GROUP BY T1.CustomerID 
ORDER BY SUM(T2.Consumption) ASC, T1.CustomerID ASC 
LIMIT 1;
Database: debit_card_specializing
Question: What was the average monthly consumption of customers in SME for the year 2013?
Evidence: Average Monthly consumption = AVG(Consumption) / 12; Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year.
SQL:
SELECT AVG(T2.Consumption) / 12 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME'
Database: debit_card_specializing
Question: Which customers, paying in CZK, consumed the most gas in 2011?
Evidence: Year 2011 can be presented as Between 201101 And 201112, which means between January and December in 2011
SQL:
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' AND T2.Date BETWEEN 201101 AND 201112 GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC, T1.CustomerID ASC LIMIT 1
Database: debit_card_specializing
Question: How many customers in KAM had a consumption of less than 30,000 for the year 2012?
Evidence: Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012
SQL:
SELECT COUNT(*) FROM ( SELECT T2.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'KAM' AND SUBSTRING(T2.Date, 1, 4) = '2012' GROUP BY T2.CustomerID HAVING SUM(T2.Consumption) < 30000 ) AS t1
Database: debit_card_specializing
Question: What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012?
Evidence: Year 2012 can be presented as Between 201201 And 201212; The first 4 strings of the Date values in the yearmonth table can represent year; Difference in Consumption = CZK customers consumption in 2012 - EUR customers consumption in 2012
SQL:
SELECT SUM(IIF(T1.Currency = 'CZK', T2.Consumption, 0)) - SUM(IIF(T1.Currency = 'EUR', T2.Consumption, 0)) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2012'
Database: debit_card_specializing
Question: Which year recorded the most gas use paid in EUR?
SQL:
SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Which segment had the least consumption?
SQL:
SELECT T1.Segment FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.Segment ORDER BY SUM(T2.Consumption) ASC LIMIT 1
Database: debit_card_specializing
Question: Which year recorded the most consumption of gas paid in CZK?
Evidence: The first 4 strings of the Date values in the yearmonth table can represent year.
SQL:
SELECT SUBSTR(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTR(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: What was the gas consumption peak month for SME customers in 2013?
Evidence: Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SQL:
SELECT SUBSTR(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTR(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: What is the difference in the annual average consumption of the customers with the least amount of consumption paid in CZK for 2013 between SME and LAM, LAM and KAM, and KAM and SME?
Evidence: annual average consumption of customer with the lowest consumption in each segment = total consumption per year / the number of customer with lowest consumption in each segment; Difference in annual average = SME's annual average - LAM's annual average; Difference in annual average = LAM's annual average - KAM's annual average; Year 2013 can be presented as Between 201301 And 201312; The first 4 strings of the Date values in the yearmonth table can represent year.
SQL:
SELECT CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID),
       CAST(SUM(IIF(T1.Segment = 'LAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID),
       CAST(SUM(IIF(T1.Segment = 'KAM', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID) - CAST(SUM(IIF(T1.Segment = 'SME', T2.Consumption, 0)) AS REAL) / COUNT(T1.CustomerID)
FROM customers AS T1
INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID
WHERE T1.Currency = 'CZK'
  AND T2.Consumption = (SELECT MIN(Consumption) FROM yearmonth)
  AND T2.Date BETWEEN 201301 AND 201312;
Database: debit_card_specializing
Question: Which of the three segments—SME, LAM and KAM—has the biggest and lowest percentage increases in consumption paid in EUR between 2012 and 2013?
Evidence: Increase or Decrease = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase or Decrease / consumption for 2012) * 100%; The first 4 strings of the Date values in the yearmonth table can represent year;
SQL:
SELECT CAST((SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2013%', T2.Consumption, 0)) - SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2012%', T2.Consumption, 0))) AS FLOAT) * 100 / NULLIF(SUM(IIF(T1.Segment = 'SME' AND T2.Date LIKE '2012%', T2.Consumption, 0)), 0) AS SME_Percentage, CAST((SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2013%', T2.Consumption, 0)) - SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2012%', T2.Consumption, 0))) AS FLOAT) * 100 / NULLIF(SUM(IIF(T1.Segment = 'LAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)), 0) AS LAM_Percentage, CAST((SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2013%', T2.Consumption, 0)) - SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2012%', T2.Consumption, 0))) AS FLOAT) * 100 / NULLIF(SUM(IIF(T1.Segment = 'KAM' AND T2.Date LIKE '2012%', T2.Consumption, 0)), 0) AS KAM_Percentage FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'EUR'
Database: debit_card_specializing
Question: How much did customer 6 consume in total between August and November 2013?
Evidence: Between August and November 2013 refers to dates between 201308 and 201311; Date format is YYYYMM where YYYY is year and MM is month
SQL:
SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'
Database: debit_card_specializing
Question: How many more "discount" gas stations does the Czech Republic have compared to Slovakia?
Evidence: Czech Republic can be represented as the Country value in gasstations table is 'CZE'; Slovakia can be represented as the Country value in the gasstations table is 'SVK';  Computation of more "discount" gas stations= Total no. of discount gas stations in Czech Republic - Total no. of discount gas stations in Slovakia
SQL:
SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount'
Database: debit_card_specializing
Question: How much more was customer 7 consuming in April 2013 than customer 5?
Evidence: April 2013 refers to 201304 in the yearmonth.date
SQL:
SELECT SUM(IIF(CustomerID = 7, Consumption, 0)) - SUM(IIF(CustomerID = 5, Consumption, 0)) FROM yearmonth WHERE Date = '201304'
Database: debit_card_specializing
Question: Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more?
Evidence: Amount of more SMEs = Total of SMEs pay using Currency CZK - Total of SMEs pay using Currency EUR
SQL:
SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME'
Database: debit_card_specializing
Question: Which LAM customer used the Euro as their currency and had the highest consumption in October 2013?
Evidence: October 2013 refers to 201310 in the yearmonth.date
SQL:
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND T2.Date = '201310' AND T1.Currency = 'EUR' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Who among KAM's customers consumed the most? How much did it consume?
SQL:
SELECT T2.CustomerID, SUM(T2.Consumption) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'KAM' GROUP BY T2.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: How much did the KAM customers consume in total in May 2013?
Evidence: May 2013 refers to yearmonth.date = 201305
SQL:
SELECT SUM(T2.Consumption) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201305' AND T1.Segment = 'KAM'
Database: debit_card_specializing
Question: How many percent of LAM customer consumed more than 46.73?
Evidence: Percentage of LAM customer consumed more than 46.73 = (Total no. of LAM customers who consumed more than 46.73 / Total no. of LAM customers) * 100.
SQL:
SELECT CAST(SUM(IIF(T2.Consumption > 46.73, 1, 0)) AS FLOAT) * 100 / COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM'
Database: debit_card_specializing
Question: Which country has more 'value for money' gas stations? Please give a total number of 'value for money' gas stations in each country.
SQL:
SELECT Country,
       COUNT(*) AS TotalCount,
       CASE WHEN COUNT(*) = (
           SELECT MAX(cnt)
           FROM (
             SELECT COUNT(*) AS cnt
             FROM gasstations
             WHERE Segment = 'Value for money'
             GROUP BY Country
           ) sub
       ) THEN 1 ELSE 0 END AS is_top
FROM gasstations
WHERE Segment = 'Value for money'
GROUP BY Country
ORDER BY TotalCount DESC, Country ASC;
Database: debit_card_specializing
Question: What percentage of KAM customers pay in euros?
Evidence: Percentage of KAM uses Euro = (Total of KAM uses Euro / Total of KAM) * 100%.
SQL:
SELECT CAST(SUM(Currency = 'EUR') AS FLOAT) * 100 / COUNT(CustomerID) FROM customers WHERE Segment = 'KAM'
Database: debit_card_specializing
Question: In February 2012, what percentage of customers consumed more than 528.3?
Evidence: February 2012 refers to '201202' in yearmonth.date; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SQL:
SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID)
FROM yearmonth
WHERE Date = '201202';
Database: debit_card_specializing
Question: What percentage of Slovakian gas stations are premium?
Evidence: Percentage of premium gas station = (Total of premium gas station in Slovakia / Total of gas station in Slovakia) * 100%.
SQL:
SELECT CAST(SUM(IIF(Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / COUNT(GasStationID) FROM gasstations WHERE Country = 'SVK'
Database: debit_card_specializing
Question: Which client ID consumed the most in September 2013?
Evidence: September 2013 refers to yearmonth.date = '201309'
SQL:
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201309' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Which client segment consumed the least in September 2013?
Evidence: September 2013 refers to yearmonth.date = '201309'
SQL:
SELECT T1.Segment FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201309' GROUP BY T1.Segment ORDER BY SUM(T2.Consumption) ASC LIMIT 1
Database: debit_card_specializing
Question: Which SME customer consumed the least in June 2012?
Evidence: June 2012 refers to yearmonth.date = '201206'
SQL:
SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Date = '201206' AND T1.Segment = 'SME' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC LIMIT 1
Database: debit_card_specializing
Question: What is the highest monthly consumption in the year 2012?
Evidence: Year and month are stored in YYYYMM format.
SQL:
SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR(Date, 1, 4) = '2012' GROUP BY SUBSTR(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: What is the biggest monthly consumption of the customers who use euro as their currency?
Evidence: biggest monthly consumption = MAX(Consumption)
SQL:
SELECT
  MAX(y.Consumption) AS biggest_monthly_consumption
FROM yearmonth AS y
JOIN customers AS c
  ON c.CustomerID = y.CustomerID
WHERE c.Currency = 'EUR';
Database: debit_card_specializing
Question: Please list the product description of the products consumed in September, 2013.
Evidence: September 2013 refers to 201309; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month.
SQL:
SELECT T3.Description FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID WHERE T2.Date = '201309'
Database: debit_card_specializing
Question: Please list the countries of the gas stations with transactions taken place in August, 2012.
Evidence: June 2013 refers to '201306'; The first 4 strings of the Date values in the yearmonth table can represent year; The 5th and 6th string of the date can refer to month;
SQL:
SELECT DISTINCT g.Country
FROM transactions_1k t
INNER JOIN gasstations g ON t.GasStationID = g.GasStationID
WHERE strftime('%Y%m', t.Date) = '201208'
ORDER BY g.Country;
Database: debit_card_specializing
Question: Please list the chains of the gas stations with transactions in euro.
SQL:
SELECT DISTINCT T3.ChainID FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN gasstations AS T3 ON T1.GasStationID = T3.GasStationID WHERE T2.Currency = 'EUR'
Database: debit_card_specializing
Question: Please list the product description of the products bought in transactions in euro.
SQL:
SELECT DISTINCT T3.Description
FROM transactions_1k AS T1 
INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID 
INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID 
WHERE T2.Currency = 'EUR'
Database: debit_card_specializing
Question: What is the average total price of the transactions taken place in January, 2012?
Evidence: In January, 2012 means Date contains '2012-01'
SQL:
SELECT AVG(Price) FROM transactions_1k WHERE Date LIKE '2012-01%'
Database: debit_card_specializing
Question: Among the customers who paid in euro, how many of them have a monthly consumption of over 1000?
Evidence: Pays in euro refers to Currency = 'EUR'.
SQL:
SELECT COUNT(DISTINCT T1.CustomerID) FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.00
Database: debit_card_specializing
Question: Please list the product descriptions of the transactions taken place in the gas stations in the Czech Republic.
Evidence: Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; 
SQL:
SELECT DISTINCT T3.Description FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN products AS T3 ON T1.ProductID = T3.ProductID WHERE T2.Country = 'CZE'
Database: debit_card_specializing
Question: Please list the disparate time of the transactions taken place in the gas stations from chain no. 11.
SQL:
SELECT DISTINCT T1.Time FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.ChainID = 11
Database: debit_card_specializing
Question: How many transactions taken place in the gas station in the Czech Republic are with a price of over 1000?
Evidence: Gas station in the Czech Republic implies that Country = 'CZE'
SQL:
SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.Country = 'CZE' AND T1.Price > 1000
Database: debit_card_specializing
Question: Among the transactions made in the gas stations in the Czech Republic, how many of them are taken place after 2012/1/1?
Evidence: Czech Republic can be represented as the Country value in the gasstations table is 'CZE'
SQL:
SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.Country = 'CZE' AND STRFTIME('%Y', T1.Date) >= '2012'
Database: debit_card_specializing
Question: What is the average total price of the transactions taken place in gas stations in the Czech Republic?
Evidence: Gas station in the Czech Republic implies that Country = 'CZE'
SQL:
SELECT AVG(T1.Price) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T2.Country = 'CZE'
Database: debit_card_specializing
Question: For the customers who paid with euros, what is their average total price of the transactions?
SQL:
SELECT AVG(T1.Price) FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR'
Database: debit_card_specializing
Question: Which customer paid the most in 2012/8/25? If there is a tie, list any one customer.
Evidence: '2012/8/25' can be represented by '2012-08-25'
SQL:
SELECT CustomerID FROM transactions_1k WHERE Date = '2012-08-25' GROUP BY CustomerID ORDER BY SUM(Price) DESC, CustomerID ASC LIMIT 1
Database: debit_card_specializing
Question: Which country's gas station had the first paid cusomer in 2012/8/25?
Evidence: '2012/8/25' can be represented by '2012-08-25'
SQL:
SELECT T2.Country 
FROM transactions_1k AS T1 
INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID 
WHERE T1.Date = '2012-08-25' 
ORDER BY T1.Time ASC 
LIMIT 1
Database: debit_card_specializing
Question: What kind of currency did the customer paid at 16:25:00 in 2012/8/24?
Evidence: '2012/8/24' can be represented by '2012-08-24';
SQL:
SELECT DISTINCT T3.Currency FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN customers AS T3 ON T1.CustomerID = T3.CustomerID WHERE T1.Date = '2012-08-24' AND T1.Time = '16:25:00'
Database: debit_card_specializing
Question: What segment did the customer have at 2012/8/23 21:20:00?
Evidence: '2012/8/23' can be represented by '2012-08-23'
SQL:
SELECT T2.Segment FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.date = '2012-08-23' AND T1.time = '21:20:00'
Database: debit_card_specializing
Question: How many transactions were paid in CZK in the morning of 2012/8/26?
Evidence: '2012/8/26' can be represented by '2012-08-26'; The morning refers to the time before '13:00:00'
SQL:
SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-26' AND T1.Time < '13:00:00' AND T2.Currency = 'CZK'
Database: debit_card_specializing
Question: For the earliest customer, what segment did he/she have?
SQL:
SELECT T2.Segment FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID ORDER BY Date ASC LIMIT 1
Database: debit_card_specializing
Question: For the deal happened at 2012/8/24 12:42:00, which country was it?
Evidence: '2012/8/24 12:42:00' can refer to date = '2012-08-24' AND T1.time = '12:42:00' in the database
SQL:
SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-24' AND T1.Time = '12:42:00'
Database: debit_card_specializing
Question: What was the product id of the transaction happened at 2012/8/23 21:20:00?
Evidence: '2012/8/23 21:20:00' can refer to date = '2012-08-23' AND T1.time = '21:20:00' in the database
SQL:
SELECT T1.ProductID FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-23' AND T1.Time = '21:20:00'
Database: debit_card_specializing
Question: For the customer who paid 124.05 in 2012/8/24, how much did he/she spend during the January of 2012? And what is the date and expenses exactly?
Evidence: expense and consumption have similar meanings
SQL:
SELECT T1.CustomerID, T2.Date, T2.Consumption FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-24' AND T1.Price = 124.05 AND T2.Date = '201201'
Database: debit_card_specializing
Question: For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE?
Evidence: Czech Republic can be represented as the Country value in the gasstations table is 'CZE'; '2012/8/26' can be represented by '2012-08-26'; during 8:00-9:00 can be represented as Time BETWEEN '08:00:00' AND '09:00:00'
SQL:
SELECT COUNT(T1.TransactionID) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-26' AND T1.Time BETWEEN '08:00:00' AND '09:00:00' AND T2.Country = 'CZE'
Database: debit_card_specializing
Question: There's one customer spent 214582.17 in the June of 2013, which currency did he/she use?
Evidence: June of 2013 means Date contains '201306' in the yearmonth.date of the database
SQL:
SELECT T2.Currency FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '201306' AND T1.Consumption = 214582.17
Database: debit_card_specializing
Question: Which country was the card owner of No.667467 in?
SQL:
SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.CardID = '667467'
Database: debit_card_specializing
Question: In which country did the customer who spent 548.4 on 2012/8/24 make this transaction?
Evidence: '2012/8/24' can be represented by '2012-08-24'
SQL:
SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-24' AND T1.Price = 548.4
Database: debit_card_specializing
Question: What is the percentage of the customers who used EUR in 2012/8/25?
Evidence: '2012/8/25' can be represented by '2012-08-25'
SQL:
SELECT CAST(COUNT(DISTINCT CASE WHEN T2.Currency = 'EUR' THEN T1.CustomerID END) AS FLOAT) * 100.0
       / COUNT(DISTINCT T1.CustomerID) AS pct_eur_customers
FROM transactions_1k AS T1
INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID
WHERE T1.Date = '2012-08-25';
Database: debit_card_specializing
Question: For the customer who paid 634.8 in 2012/8/25, what was the consumption decrease rate from Year 2012 to 2013?
Evidence: '2012/8/24' can be represented by '2012-08-24'; Consumption decrease rate = (consumption_2012 - consumption_2013) / consumption_2012
SQL:
SELECT CAST(SUM(IIF(SUBSTR(Date, 1, 4) = '2012', Consumption, 0)) - SUM(IIF(SUBSTR(Date, 1, 4) = '2013', Consumption, 0)) AS FLOAT) / SUM(IIF(SUBSTR(Date, 1, 4) = '2012', Consumption, 0)) FROM yearmonth WHERE CustomerID = ( SELECT T1.CustomerID FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.Date = '2012-08-25' AND T1.Price = 634.8 )
Database: debit_card_specializing
Question: Which gas station has the highest amount of revenue?
SQL:
SELECT GasStationID FROM transactions_1k GROUP BY GasStationID ORDER BY SUM(Price) DESC LIMIT 1
Database: debit_card_specializing
Question: What is the percentage of "premium" against the overall segment in Country = "SVK"?
SQL:
SELECT CAST(SUM(IIF(Country = 'SVK' AND Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations
Database: debit_card_specializing
Question: What is the amount spent by customer 38508 at the gas stations? How much had the customer spent in January 2012?
SQL:
SELECT SUM(Price) AS total_spent,
       SUM(CASE WHEN strftime('%Y%m', Date) = '201201' THEN Price ELSE 0 END) AS jan_2012_spent
FROM transactions_1k
WHERE CustomerID = 38508;
Database: debit_card_specializing
Question: Which are the top five best selling products? Please state the full name of them.
Evidence: Description of products contains full name
SQL:
SELECT T2.Description FROM transactions_1k AS T1 INNER JOIN products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Amount DESC LIMIT 5
Database: debit_card_specializing
Question: Who is the top spending customer and how much is the average price per single item purchased by this customer? What currency was being used?
Evidence: average price per single item = Total(price) / Total(amount)
SQL:
SELECT 
    t.CustomerID,
    SUM(t.Price) / SUM(t.Amount) AS avg_price_per_item,
    c.Currency
FROM transactions_1k t
JOIN customers c ON t.CustomerID = c.CustomerID
WHERE t.CustomerID = (
    SELECT CustomerID
    FROM transactions_1k
    GROUP BY CustomerID
    ORDER BY SUM(Price) DESC
    LIMIT 1
)
GROUP BY t.CustomerID, c.Currency
Database: debit_card_specializing
Question: Which country had the gas station that sold the most expensive product id No.2 for one unit?
SQL:
SELECT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID WHERE T1.ProductID = 2 ORDER BY T1.Price DESC LIMIT 1
Database: debit_card_specializing
Question: For all the people who paid more than 29.00 per unit of product id No.5. Give their consumption status in the August of 2012.
Evidence: August of 2012 refers to the Date value = '201208' ; Price per unit of product = Price / Amount;
SQL:
SELECT T2.Consumption FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Price / T1.Amount > 29.00 AND T1.ProductID = 5 AND T2.Date = '201208'