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 (SQLite): 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
SQL (SQL Server): SELECT TRY_CAST(SUM(IIF(T1.Segment = 'SME', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID) - TRY_CAST(SUM(IIF(T1.Segment = 'LAM', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID), TRY_CAST(SUM(IIF(T1.Segment = 'LAM', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID) - TRY_CAST(SUM(IIF(T1.Segment = 'KAM', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID), TRY_CAST(SUM(IIF(T1.Segment = 'KAM', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID) - TRY_CAST(SUM(IIF(T1.Segment = 'SME', TRY_CAST(T2.Consumption AS FLOAT), 0.0)) AS FLOAT) / COUNT(T1.CustomerID) AS _agg1 FROM customers AS T1 INNER JOIN yearmonth AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Currency = 'CZK' AND T2.Consumption = ( SELECT MIN(Consumption) AS _agg2 FROM yearmonth ) AND T2.Date BETWEEN 201301 AND 201312
SQL (Oracle): SELECT CAST(SUM(CASE WHEN T1.Segment = 'SME' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID) - CAST(SUM(CASE WHEN T1.Segment = 'LAM' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID), CAST(SUM(CASE WHEN T1.Segment = 'LAM' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID) - CAST(SUM(CASE WHEN T1.Segment = 'KAM' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID), CAST(SUM(CASE WHEN T1.Segment = 'KAM' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID) - CAST(SUM(CASE WHEN T1.Segment = 'SME' THEN CAST(T2.Consumption AS BINARY_DOUBLE) ELSE 0.0 END) AS BINARY_DOUBLE) / COUNT(T1.CustomerID) FROM customers T1 INNER JOIN yearmonth 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