Dludora/Bird-minidev-sqlserver-oracle huggingface dataset:
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 (SQLite): SELECT CAST(SUM(IIF(Currency = 'EUR', 1, 0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', 1, 0)) AS ratio FROM customers
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(Currency = 'EUR', TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) / SUM(IIF(Currency = 'CZK', TRY_CAST(1 AS FLOAT), 0.0)) AS ratio FROM customers
SQL (Oracle): SELECT CAST(SUM(CASE WHEN Currency = 'EUR' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / SUM(CASE WHEN Currency = 'CZK' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) ratio FROM customers

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 (SQLite): 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 LIMIT 1
SQL (SQL Server): SELECT T1.CustomerID FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM' AND SUBSTRING(T2.Date, 1, 4) = '2012' GROUP BY T1.CustomerID ORDER BY SUM(T2.Consumption) ASC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT T1.CustomerID FROM customers T1 INNER JOIN yearmonth 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 NULLS FIRST FETCH FIRST 1 ROWS ONLY

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 (SQLite): 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'
SQL (SQL Server): SELECT AVG(TRY_CAST(T2.Consumption AS FLOAT)) / 12 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME'
SQL (Oracle): SELECT AVG(T2.Consumption) / 12 FROM customers T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2."DATE", 1, 4) = '2013' AND T1.Segment = 'SME'
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 (SQLite): 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'
SQL (SQL Server): SELECT SUM(IIF(T1.Currency = 'CZK', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) - SUM(IIF(T1.Currency = 'EUR', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS _agg1 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2012'
SQL (Oracle): SELECT SUM(CASE WHEN T1.Currency = 'CZK' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) - SUM(CASE WHEN T1.Currency = 'EUR' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) FROM customers T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTR(T2."DATE", 1, 4) = '2012'

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 (SQLite): 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
SQL (SQL Server): SELECT SUBSTRING(T2.Date, 1, 4) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTRING(T2.Date, 1, 4) ORDER BY SUM(T2.Consumption) DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT SUBSTR(T2."DATE", 1, 4) FROM customers T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' GROUP BY SUBSTR(T2."DATE", 1, 4) ORDER BY SUM(T2.Consumption) DESC NULLS LAST FETCH FIRST 1 ROWS ONLY
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 (SQLite): 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
SQL (SQL Server): SELECT SUBSTRING(T2.Date, 5, 2) FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE SUBSTRING(T2.Date, 1, 4) = '2013' AND T1.Segment = 'SME' GROUP BY SUBSTRING(T2.Date, 5, 2) ORDER BY SUM(T2.Consumption) DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT SUBSTR(T2."DATE", 5, 2) FROM customers T1 INNER JOIN yearmonth 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 NULLS LAST FETCH FIRST 1 ROWS ONLY
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 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.
SQL (SQLite): SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'
SQL (SQL Server): SELECT SUM(Consumption) AS _agg1 FROM yearmonth WHERE CustomerID = 6 AND Date BETWEEN '201308' AND '201311'
SQL (Oracle): SELECT SUM(Consumption) FROM yearmonth WHERE CustomerID = 6 AND "DATE" BETWEEN '201308' AND '201311'

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 (SQLite): SELECT SUM(IIF(Country = 'CZE', 1, 0)) - SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations WHERE Segment = 'Discount'
SQL (SQL Server): SELECT SUM(IIF(Country = 'CZE', TRY_CAST(1 AS FLOAT), 0.0)) - SUM(IIF(Country = 'SVK', TRY_CAST(1 AS FLOAT), 0.0)) AS _agg1 FROM gasstations WHERE Segment = 'Discount'
SQL (Oracle): SELECT SUM(CASE WHEN Country = 'CZE' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) - SUM(CASE WHEN Country = 'SVK' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM gasstations WHERE Segment = 'Discount'

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 (SQLite): SELECT SUM(Currency = 'CZK') - SUM(Currency = 'EUR') FROM customers WHERE Segment = 'SME'
SQL (SQL Server): SELECT SUM(CASE WHEN Currency = 'CZK' THEN 1 ELSE 0 END) - SUM(CASE WHEN Currency = 'EUR' THEN 1 ELSE 0 END) AS _agg1 FROM customers WHERE Segment = 'SME'
SQL (Oracle): SELECT SUM(CASE WHEN Currency = 'CZK' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) - SUM(CASE WHEN Currency = 'EUR' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM customers WHERE Segment = 'SME'
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 (SQLite): 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'
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(T2.Consumption > 46.73, TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) * 100 / COUNT(T1.CustomerID) AS _agg1 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T2.Consumption > 46.73 THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T1.CustomerID) FROM customers T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Segment = 'LAM'

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 (SQLite): SELECT CAST(SUM(IIF(Consumption > 528.3, 1, 0)) AS FLOAT) * 100 / COUNT(CustomerID) FROM yearmonth WHERE Date = '201202'
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(Consumption > 528.3, TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) * 100 / COUNT(CustomerID) AS _agg1 FROM yearmonth WHERE Date = '201202'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN Consumption > 528.3 THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(CustomerID) FROM yearmonth WHERE "DATE" = '201202'

Question: What is the highest monthly consumption in the year 2012?
Evidence: 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 (SQLite): SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR(Date, 1, 4) = '2012' GROUP BY SUBSTR(Date, 5, 2) ORDER BY SUM(Consumption) DESC LIMIT 1
SQL (SQL Server): SELECT SUM(Consumption) AS _agg1 FROM yearmonth WHERE SUBSTRING(Date, 1, 4) = '2012' GROUP BY SUBSTRING(Date, 5, 2) ORDER BY SUM(Consumption) DESC OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY
SQL (Oracle): SELECT SUM(Consumption) FROM yearmonth WHERE SUBSTR("DATE", 1, 4) = '2012' GROUP BY SUBSTR("DATE", 5, 2) ORDER BY SUM(Consumption) DESC NULLS LAST FETCH FIRST 1 ROWS ONLY
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 (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT T3.Description FROM transactions_1k T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID INNER JOIN products T3 ON T1.ProductID = T3.ProductID WHERE T2."DATE" = '201309'

Question: Please list the countries of the gas stations with transactions taken place in June, 2013.
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 (SQLite): SELECT DISTINCT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth AS T3 ON T1.CustomerID = T3.CustomerID WHERE T3.Date = '201306'
SQL (SQL Server): SELECT DISTINCT T2.Country FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth AS T3 ON T1.CustomerID = T3.CustomerID WHERE T3.Date = '201306'
SQL (Oracle): SELECT DISTINCT T2.Country FROM transactions_1k T1 INNER JOIN gasstations T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth T3 ON T1.CustomerID = T3.CustomerID WHERE T3."DATE" = '201306'

Question: Among the customers who paid in euro, how many of them have a monthly consumption of over 1000?
Evidence: Pays in euro = Currency = 'EUR'.
SQL (SQLite): SELECT COUNT(*) FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.00
SQL (SQL Server): SELECT COUNT(*) AS _agg1 FROM yearmonth AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.00
SQL (Oracle): SELECT COUNT(*) FROM yearmonth T1 INNER JOIN customers T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Currency = 'EUR' AND T1.Consumption > 1000.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 (SQLite): 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'
SQL (SQL Server): 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'
SQL (Oracle): SELECT T2.Segment FROM transactions_1k T1 INNER JOIN customers T2 ON T1.CustomerID = T2.CustomerID WHERE T1."DATE" = '2012-08-23' AND T1."TIME" = '21:20:00'

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 (SQLite): 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'
SQL (SQL Server): SELECT COUNT(T1.TransactionID) AS _agg1 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'
SQL (Oracle): SELECT COUNT(T1.TransactionID) FROM transactions_1k T1 INNER JOIN gasstations 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'

Question: What's the nationality of the customer who spent 548.4 in 2012/8/24?
Evidence: '2012/8/24' can be represented by '2012-08-24'
SQL (SQLite): 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
SQL (SQL Server): 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
SQL (Oracle): SELECT T2.Country FROM transactions_1k T1 INNER JOIN gasstations 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 (SQLite): SELECT CAST(SUM(IIF(T2.Currency = 'EUR', 1, 0)) AS FLOAT) * 100 / COUNT(T1.CustomerID) FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-25'
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(T2.Currency = 'EUR', TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) * 100 / COUNT(T1.CustomerID) AS _agg1 FROM transactions_1k AS T1 INNER JOIN customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Date = '2012-08-25'
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T2.Currency = 'EUR' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / COUNT(T1.CustomerID) FROM transactions_1k T1 INNER JOIN customers T2 ON T1.CustomerID = T2.CustomerID WHERE T1."DATE" = '2012-08-25'

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 (SQLite): SELECT CAST(SUM(IIF(SUBSTRING(Date, 1, 4) = '2012', Consumption, 0)) - SUM(IIF(SUBSTRING(Date, 1, 4) = '2013', Consumption, 0)) AS FLOAT) / SUM(IIF(SUBSTRING(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  = 1513.12 )
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(SUBSTRING(Date, 1, 4) = '2012', Consumption, 0)) - SUM(IIF(SUBSTRING(Date, 1, 4) = '2013', Consumption, 0)) AS FLOAT) / SUM(IIF(SUBSTRING(Date, 1, 4) = '2012', Consumption, 0)) AS _agg1 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  = 1513.12 )
SQL (Oracle): SELECT CAST(SUM(CASE WHEN SUBSTR("DATE", 1, 4) = '2012' THEN CAST(Consumption AS BINARY_DOUBLE) ELSE 0.0 END) - SUM(CASE WHEN SUBSTR("DATE", 1, 4) = '2013' THEN CAST(Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / SUM(CASE WHEN SUBSTR("DATE", 1, 4) = '2012' THEN CAST(Consumption AS BINARY_DOUBLE) ELSE 0.0 END) FROM yearmonth WHERE CustomerID = ( SELECT T1.CustomerID FROM transactions_1k T1 INNER JOIN gasstations T2 ON T1.GasStationID = T2.GasStationID WHERE T1."DATE" = '2012-08-25' AND T1.Price  = 1513.12 )
Database: debit_card_specializing

Question: What is the percentage of "premium" against the overall segment in Country = "SVK"?
SQL (SQLite): SELECT CAST(SUM(IIF(Country = 'SVK' AND Segment = 'Premium', 1, 0)) AS FLOAT) * 100 / SUM(IIF(Country = 'SVK', 1, 0)) FROM gasstations
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(Country = 'SVK' AND Segment = 'Premium', TRY_CAST(1 AS FLOAT), 0.0)) AS FLOAT) * 100 / SUM(IIF(Country = 'SVK', TRY_CAST(1 AS FLOAT), 0.0)) AS _agg1 FROM gasstations
SQL (Oracle): SELECT CAST(SUM(CASE WHEN Country = 'SVK' AND Segment = 'Premium' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) * 100 / SUM(CASE WHEN Country = 'SVK' THEN CAST(1 AS BINARY_DOUBLE) ELSE 0.0 END) FROM gasstations

Question: What is the amount spent by customer "38508" at the gas stations? How much had the customer spent in January 2012?
Evidence: January 2012 refers to the Date value = '201201'
SQL (SQLite): SELECT SUM(T1.Price ) , SUM(IIF(T3.Date = '201201', T1.Price, 0)) FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth AS T3 ON T1.CustomerID = T3.CustomerID WHERE T1.CustomerID = '38508'
SQL (SQL Server): SELECT SUM(T1.Price ), SUM(IIF(T3.Date = '201201', TRY_CAST(T1.Price AS FLOAT), 0.0)) AS _agg1 FROM transactions_1k AS T1 INNER JOIN gasstations AS T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth AS T3 ON T1.CustomerID = T3.CustomerID WHERE T1.CustomerID = '38508'
SQL (Oracle): SELECT SUM(T1.Price ), SUM(CASE WHEN T3."DATE" = '201201' THEN CAST(T1.Price AS BINARY_DOUBLE) ELSE 0.0 END) FROM transactions_1k T1 INNER JOIN gasstations T2 ON T1.GasStationID = T2.GasStationID INNER JOIN yearmonth T3 ON T1.CustomerID = T3.CustomerID WHERE T1.CustomerID = '38508'

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 (SQLite): SELECT T2.CustomerID, SUM(T2.Price / T2.Amount), T1.Currency FROM customers AS T1 INNER JOIN transactions_1k AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CustomerID = ( SELECT CustomerID FROM yearmonth ORDER BY Consumption DESC LIMIT 1 ) GROUP BY T2.CustomerID, T1.Currency
SQL (SQL Server): SELECT T2.CustomerID, SUM(T2.Price / NULLIF(T2.Amount, 0)), T1.Currency FROM customers AS T1 INNER JOIN transactions_1k AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CustomerID = ( SELECT TOP 1 CustomerID FROM yearmonth ORDER BY Consumption DESC ) GROUP BY T2.CustomerID, T1.Currency
SQL (Oracle): SELECT T2.CustomerID, SUM(T2.Price / NULLIF(T2.Amount, 0)), T1.Currency FROM customers T1 INNER JOIN transactions_1k T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CustomerID = ( SELECT CustomerID FROM yearmonth ORDER BY Consumption DESC NULLS LAST FETCH FIRST 1 ROWS ONLY ) GROUP BY T2.CustomerID, T1.Currency
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 (SQLite): 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'
SQL (SQL Server): SELECT T2.Consumption FROM transactions_1k AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Price / NULLIF(T1.Amount, 0) > 29.00 AND T1.ProductID = 5 AND T2.Date = '201208'
SQL (Oracle): SELECT T2.Consumption FROM transactions_1k T1 INNER JOIN yearmonth T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Price / NULLIF(T1.Amount, 0) > 29.00 AND T1.ProductID = 5 AND T2."DATE" = '201208'