Chinastark/bird_dataset huggingface dataset:
Database: debit_card_specializing
Note: 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.;
Question: In 2012, who had the least consumption in LAM?
SQL: SELECT customers.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.segment = 'LAM' AND substr(yearmonth.date, 1, 4) = '2012' GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) ASC LIMIT 1
Database: debit_card_specializing
Note: 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.;
Question: What was the average monthly consumption of customers in SME for the year 2013?
SQL: SELECT avg(yearmonth.consumption) / 12 FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE substr(yearmonth.date, 1, 4) = '2013' AND customers.segment = 'SME'
Database: debit_card_specializing
Note: Year 2011 can be presented as Between 201101 And 201112, which means between January and December in 2011;
Question: Which customers, paying in CZK, consumed the most gas in 2011?
SQL: SELECT customers.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.currency = 'CZK' AND yearmonth.date BETWEEN 201101 AND 201112 GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Note: Year 2012 can be presented as Between 201201 And 201212, which means between January and December in 2012;
Question: How many customers in KAM had a consumption of less than 30,000 for the year 2012?
SQL: SELECT count(*) FROM ( SELECT yearmonth.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.segment = 'KAM' AND substring(yearmonth.date, 1, 4) = '2012' GROUP BY yearmonth.customerid HAVING sum(yearmonth.consumption) < 30000 ) AS customers
Database: debit_card_specializing
Note: 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;
Question: What was the difference in gas consumption between CZK-paying customers and EUR-paying customers in 2012?
SQL: SELECT sum(iif(customers.currency = 'CZK', yearmonth.consumption, 0)) - sum(iif(customers.currency = 'EUR', yearmonth.consumption, 0)) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE substr(yearmonth.date, 1, 4) = '2012'
Database: debit_card_specializing
Question: Which year recorded the most gas use paid in EUR?
SQL: SELECT substring(yearmonth.date, 1, 4) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.currency = 'EUR' GROUP BY substring(yearmonth.date, 1, 4) ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Which segment had the least consumption?
SQL: SELECT customers.segment FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid GROUP BY customers.segment ORDER BY sum(yearmonth.consumption) ASC LIMIT 1
Database: debit_card_specializing
Note: The first 4 strings of the date values in the yearmonth table can represent year.;
Question: Which year recorded the most consumption of gas paid in CZK?
SQL: SELECT substr(yearmonth.date, 1, 4) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.currency = 'CZK' GROUP BY substr(yearmonth.date, 1, 4) ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Note: 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.;
Question: What was the gas consumption peak month for SME customers in 2013?
SQL: SELECT substr(yearmonth.date, 5, 2) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE substr(yearmonth.date, 1, 4) = '2013' AND customers.segment = 'SME' GROUP BY substr(yearmonth.date, 5, 2) ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Note: 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.;
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?
SQL: SELECT cast(sum(iif(customers.segment = 'SME', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) - cast(sum(iif(customers.segment = 'LAM', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) , cast(sum(iif(customers.segment = 'LAM', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) - cast(sum(iif(customers.segment = 'KAM', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) , cast(sum(iif(customers.segment = 'KAM', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) - cast(sum(iif(customers.segment = 'SME', yearmonth.consumption, 0)) AS REAL) / count(customers.customerid) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.currency = 'CZK' AND yearmonth.consumption = ( SELECT min(consumption) FROM yearmonth ) AND yearmonth.date BETWEEN 201301 AND 201312
Database: debit_card_specializing
Note: Increase or Decrease = consumption for 2013 - consumption for 2012; Percentage of Increase = (Increase or Decrease / consumption for 2013) * 100%; The first 4 strings of the date values in the yearmonth table can represent year;
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?
SQL: SELECT cast((sum(iif(customers.segment = 'SME' AND yearmonth.date LIKE '2013%', yearmonth.consumption, 0)) - sum(iif(customers.segment = 'SME' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0))) AS FLOAT) * 100 / sum(iif(customers.segment = 'SME' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0)), cast(sum(iif(customers.segment = 'LAM' AND yearmonth.date LIKE '2013%', yearmonth.consumption, 0)) - sum(iif(customers.segment = 'LAM' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0)) AS FLOAT) * 100 / sum(iif(customers.segment = 'LAM' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0)) , cast(sum(iif(customers.segment = 'KAM' AND yearmonth.date LIKE '2013%', yearmonth.consumption, 0)) - sum(iif(customers.segment = 'KAM' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0)) AS FLOAT) * 100 / sum(iif(customers.segment = 'KAM' AND yearmonth.date LIKE '2012%', yearmonth.consumption, 0)) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid
Database: debit_card_specializing
Note: Between August And November 2013 refers to Between 201308 And 201311; 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.;
Question: How much did customer 6 consume in total between August and November 2013?
SQL: SELECT sum(consumption) FROM yearmonth WHERE customerid = 6 AND Date BETWEEN '201308' AND '201311'
Database: debit_card_specializing
Note: 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;
Question: How many more "discount" gas stations does the Czech Republic have compared to Slovakia?
SQL: SELECT sum(iif(country = 'CZE', 1, 0)) - sum(iif(country = 'SVK', 1, 0)) FROM gasstations WHERE SEGMENT = 'Discount'
Database: debit_card_specializing
Note: April 2013 refers to 201304 in the yearmonth.date;
Question: How much more was customer 7 consuming in April 2013 than customer 5?
SQL: SELECT sum(iif(customerid = 7, consumption, 0)) - sum(iif(customerid = 5, consumption, 0)) FROM yearmonth WHERE Date = '201304'
Database: debit_card_specializing
Note: amount of more SMEs = Total of SMEs pay using currency CZK - Total of SMEs pay using currency EUR;
Question: Is it true that more SMEs pay in Czech koruna than in euros? If so, how many more?
SQL: SELECT sum(currency = 'CZK') - sum(currency = 'EUR') FROM customers WHERE SEGMENT = 'SME'
Database: debit_card_specializing
Note: October 2013 refers to 201310 in the yearmonth.date;
Question: Which LAM customer used the Euro as their currency and had the highest consumption in October 2013?
SQL: SELECT customers.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.segment = 'LAM' AND yearmonth.date = '201310' AND customers.currency = 'EUR' GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Question: Who among KAM's customers consumed the most? How much did it consume?
SQL: SELECT yearmonth.customerid, sum(yearmonth.consumption) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.segment = 'KAM' GROUP BY yearmonth.customerid ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Note: May 2013 refers to yearmonth.date = 201305;
Question: How much did the KAM customers consume in total in May 2013?
SQL: SELECT sum(yearmonth.consumption) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE yearmonth.date = '201305' AND customers.segment = 'KAM'
Database: debit_card_specializing
Note: 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.;
Question: How many percent of LAM customer consumed more than 46.73?
SQL: SELECT cast(sum(iif(yearmonth.consumption > 46.73, 1, 0)) AS FLOAT) * 100 / count(customers.customerid) FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.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 , ( SELECT count(gasstationid) FROM gasstations WHERE SEGMENT = 'Value for money' ) FROM gasstations WHERE SEGMENT = 'Value for money' GROUP BY country ORDER BY count(gasstationid) DESC LIMIT 1
Database: debit_card_specializing
Note: Percentage of KAM uses Euro = (Total of KAM uses Euro / Total of KAM) * 100%.;
Question: What percentage of KAM customers pay in euros?
SQL: SELECT cast(sum(currency = 'EUR') AS FLOAT) * 100 / count(customerid) FROM customers WHERE SEGMENT = 'KAM'
Database: debit_card_specializing
Note: 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.;
Question: In February 2012, what percentage of customers consumed more than 528.3?
SQL: SELECT cast(sum(iif(consumption > 528.3, 1, 0)) AS FLOAT) * 100 / count(customerid) FROM yearmonth WHERE Date = '201202'
Database: debit_card_specializing
Note: Percentage of premium gas station = (Total of premium gas station in Slovakia / Total of gas station in Slovakia) * 100%.;
Question: What percentage of Slovakian gas stations are premium?
SQL: SELECT cast(sum(iif(SEGMENT = 'Premium', 1, 0)) AS FLOAT) * 100 / count(gasstationid) FROM gasstations WHERE country = 'SVK'
Database: debit_card_specializing
Note: September 2013 refers to yearmonth.date = '201309';
Question: Which client ID consumed the most in September 2013?
SQL: SELECT customers.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE yearmonth.date = '201309' GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) DESC LIMIT 1
Database: debit_card_specializing
Note: September 2013 refers to yearmonth.date = '201309';
Question: Which client segment consumed the least in September 2013?
SQL: SELECT customers.segment FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE yearmonth.date = '201309' GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) ASC LIMIT 1
Database: debit_card_specializing
Note: June 2012 refers to yearmonth.date = '201206';
Question: Which SME customer consumed the least in June 2012?
SQL: SELECT customers.customerid FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE yearmonth.date = '201206' AND customers.segment = 'SME' GROUP BY customers.customerid ORDER BY sum(yearmonth.consumption) ASC LIMIT 1
Database: debit_card_specializing
Note: 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.;
Question: What is the highest monthly consumption in the year 2012?
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
Note: Monthly consumption = SUM(consumption) / 12;
Question: What is the biggest monthly consumption of the customers who use euro as their currency?
SQL: SELECT sum(yearmonth.consumption) / 12 AS monthlyconsumption FROM customers INNER JOIN yearmonth ON customers.customerid = yearmonth.customerid WHERE customers.currency = 'EUR' GROUP BY customers.customerid ORDER BY monthlyconsumption DESC LIMIT 1
Database: debit_card_specializing
Note: 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.;
Question: Please list the product description of the products consumed in September, 2013.
SQL: SELECT products.description FROM transactions_1k INNER JOIN yearmonth ON transactions_1k.customerid = yearmonth.customerid INNER JOIN products ON transactions_1k.productid = products.productid WHERE yearmonth.date = '201309'
Database: debit_card_specializing
Note: 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;
Question: Please list the countries of the gas stations with transactions taken place in June, 2013.
SQL: SELECT DISTINCT gasstations.country FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid INNER JOIN yearmonth ON transactions_1k.customerid = yearmonth.customerid WHERE yearmonth.date = '201306'
Database: debit_card_specializing
Question: Please list the chains of the gas stations with transactions in euro.
SQL: SELECT DISTINCT gasstations.chainid FROM transactions_1k INNER JOIN customers ON transactions_1k.customerid = customers.customerid INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE customers.currency = 'EUR'
Database: debit_card_specializing
Question: Please list the product description of the products bought in transactions in euro.
SQL: SELECT DISTINCT transactions_1k.productid, products.description FROM transactions_1k INNER JOIN customers ON transactions_1k.customerid = customers.customerid INNER JOIN products ON transactions_1k.productid = products.productid WHERE customers.currency = 'EUR'
Database: debit_card_specializing
Note: In January, 2012 means date contains '2012-01';
Question: What is the average total price of the transactions taken place in January, 2012?
SQL: SELECT avg(amount) FROM transactions_1k WHERE Date LIKE '2012-01%'
Database: debit_card_specializing
Note: Pays in euro = currency = 'EUR'.;
Question: Among the customers who paid in euro, how many of them have a monthly consumption of over 1000?
SQL: SELECT count(*) FROM yearmonth INNER JOIN customers ON yearmonth.customerid = customers.customerid WHERE customers.currency = 'EUR' AND yearmonth.consumption > 1000.00
Database: debit_card_specializing
Note: Czech Republic can be represented as the country value in the gasstations table is 'CZE';
Question: Please list the product descriptions of the transactions taken place in the gas stations in the Czech Republic.
SQL: SELECT DISTINCT products.description FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid INNER JOIN products ON transactions_1k.productid = products.productid WHERE gasstations.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 transactions_1k.time FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE gasstations.chainid = 11
Database: debit_card_specializing
Note: Gas station in the Czech Republic implies that country = 'CZE';
Question: How many transactions taken place in the gas station in the Czech Republic are with a price of over 1000?
SQL: SELECT count(transactions_1k.transactionid) FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE gasstations.country = 'CZE' AND transactions_1k.price > 1000
Database: debit_card_specializing
Note: Czech Republic can be represented as the country value in the gasstations table is 'CZE';
Question: Among the transactions made in the gas stations in the Czech Republic, how many of them are taken place after 2012/1/1?
SQL: SELECT count(transactions_1k.transactionid) FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE gasstations.country = 'CZE' AND strftime('%Y', transactions_1k.date) >= '2012'
Database: debit_card_specializing
Note: Gas station in the Czech Republic implies that country = 'CZE';
Question: What is the average total price of the transactions taken place in gas stations in the Czech Republic?
SQL: SELECT avg(transactions_1k.price) FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE gasstations.country = 'CZE'
Database: debit_card_specializing
Question: For the customers who paid in the euro, what is their average total price of the transactions?
SQL: SELECT avg(transactions_1k.price) FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid INNER JOIN customers ON transactions_1k.customerid = customers.customerid WHERE customers.currency = 'EUR'
Database: debit_card_specializing
Note: '2012/8/25' can be represented by '2012-08-25';
Question: Which customer paid the most in 2012/8/25?
SQL: SELECT customerid FROM transactions_1k WHERE Date = '2012-08-25' GROUP BY customerid ORDER BY sum(price) DESC LIMIT 1
Database: debit_card_specializing
Note: '2012/8/25' can be represented by '2012-08-25';
Question: Which country's gas station had the first paid cusomer in 2012/8/25?
SQL: SELECT gasstations.country FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE transactions_1k.date = '2012-08-25' ORDER BY transactions_1k.time DESC LIMIT 1
Database: debit_card_specializing
Note: '2012/8/24' can be represented by '2012-08-24';
Question: What kind of currency did the customer paid at 16:25:00 in 2012/8/24?
SQL: SELECT DISTINCT customers.currency FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid INNER JOIN customers ON transactions_1k.customerid = customers.customerid WHERE transactions_1k.date = '2012-08-24' AND transactions_1k.time = '16:25:00'
Database: debit_card_specializing
Note: '2012/8/23' can be represented by '2012-08-23';
Question: What segment did the customer have at 2012/8/23 21:20:00?
SQL: SELECT customers.segment FROM transactions_1k INNER JOIN customers ON transactions_1k.customerid = customers.customerid WHERE transactions_1k.date = '2012-08-23' AND transactions_1k.time = '21:20:00'
Database: debit_card_specializing
Note: '2012/8/26' can be represented by '2012-08-26'; The morning refers to the time before '13:00:00';
Question: How many transactions were paid in CZK in the morning of 2012/8/26?
SQL: SELECT count(transactions_1k.transactionid) FROM transactions_1k INNER JOIN customers ON transactions_1k.customerid = customers.customerid WHERE transactions_1k.date = '2012-08-26' AND transactions_1k.time < '13:00:00' AND customers.currency = 'CZK'
Database: debit_card_specializing
Question: For the earliest customer, what segment did he/she have?
SQL: SELECT customers.segment FROM transactions_1k INNER JOIN customers ON transactions_1k.customerid = customers.customerid ORDER BY Date ASC LIMIT 1
Database: debit_card_specializing
Note: '2012/8/24 12:42:00' can refer to date = '2012-08-24' AND T1.time = '12:42:00' in the database;
Question: For the deal happened at 2012/8/24 12:42:00, which country was it?
SQL: SELECT gasstations.country FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE transactions_1k.date = '2012-08-24' AND transactions_1k.time = '12:42:00'
Database: debit_card_specializing
Note: '2012/8/23 21:20:00' can refer to date = '2012-08-23' AND T1.time = '21:20:00' in the database;
Question: What was the product id of the transaction happened at 2012/8/23 21:20:00?
SQL: SELECT transactions_1k.productid FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE transactions_1k.date = '2012-08-23' AND transactions_1k.time = '21:20:00'
Database: debit_card_specializing
Note: '2012/8/24' can be represented by '2012-08-24'; expense and the consumption has the similar meaning.;
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?
SQL: SELECT transactions_1k.customerid, yearmonth.date, yearmonth.consumption FROM transactions_1k INNER JOIN yearmonth ON transactions_1k.customerid = yearmonth.customerid WHERE transactions_1k.date = '2012-08-24' AND transactions_1k.price = 124.05 AND yearmonth.date = '201201'
Database: debit_card_specializing
Note: 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';
Question: For all the transactions happened during 8:00-9:00 in 2012/8/26, how many happened in CZE?
SQL: SELECT count(transactions_1k.transactionid) FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE transactions_1k.date = '2012-08-26' AND transactions_1k.time BETWEEN '08:00:00' AND '09:00:00' AND gasstations.country = 'CZE'
Database: debit_card_specializing
Note: June of 2013 means date contains '201306' in the yearmonth.date of the database;
Question: There's one customer spent 214582.17 in the June of 2013, which currency did he/she use?
SQL: SELECT customers.currency FROM yearmonth INNER JOIN customers ON yearmonth.customerid = customers.customerid WHERE yearmonth.date = '201306' AND yearmonth.consumption = 214582.17
Database: debit_card_specializing
Question: Which country was the card owner of No.667467 in?
SQL: SELECT gasstations.country FROM transactions_1k INNER JOIN gasstations ON transactions_1k.gasstationid = gasstations.gasstationid WHERE transactions_1k.cardid = '667467'