Skip to content

Instantly share code, notes, and snippets.

View kokosing's full-sized avatar
💤

Grzegorz Kokosiński kokosing

💤
View GitHub Profile
*** q95.sql 2016-03-25 14:10:21.910553746 +0100
--- q95_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 11,21 ****
sum(ws_net_profit) AS "total net profit"
FROM "${database}"."${schema}".web_sales ws1 ,
"${database}"."${schema}".date_dim ,
"${database}"."${schema}".customer_address ,
"${database}"."${schema}".web_site
! WHERE d_date BETWEEN '2000-5-01' AND (cast('2000-5-01' AS date) + 60 days)
*** q94.sql 2016-03-25 14:10:21.910553746 +0100
--- q94_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 3,13 ****
sum(ws_net_profit) AS "total net profit"
FROM "${database}"."${schema}".web_sales ws1 ,
"${database}"."${schema}".date_dim ,
"${database}"."${schema}".customer_address ,
"${database}"."${schema}".web_site
! WHERE d_date BETWEEN '2002-3-01' AND (cast('2002-3-01' AS date) + 60 days)
*** q92.sql 2016-03-25 14:10:21.910553746 +0100
--- q92_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 2,16 ****
FROM "${database}"."${schema}".web_sales,
"${database}"."${schema}".item,
"${database}"."${schema}".date_dim
WHERE i_manufact_id = 961
AND i_item_sk = ws_item_sk
! AND d_date BETWEEN '2001-03-04' AND (cast('2001-03-04' AS date) + 90 days)
*** q82.sql 2016-03-25 14:10:21.910553746 +0100
--- q82_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 6,16 ****
"${database}"."${schema}".date_dim,
"${database}"."${schema}".store_sales
WHERE i_current_price BETWEEN 44 AND 44+30
AND inv_item_sk = i_item_sk
AND d_date_sk=inv_date_sk
! AND d_date BETWEEN cast('1998-06-13' AS date) AND (cast('1998-06-13' AS date) + 60 days)
*** q80.sql 2016-03-25 14:10:21.910553746 +0100
--- q80_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 8,18 ****
AND ss_ticket_number = sr_ticket_number), "${database}"."${schema}".date_dim,
"${database}"."${schema}".store,
"${database}"."${schema}".item,
"${database}"."${schema}".promotion
WHERE ss_sold_date_sk = d_date_sk
! AND d_date BETWEEN cast('2002-08-05' AS date) AND (cast('2002-08-05' AS date) + 30 days)
*** q77.sql 2016-03-25 14:10:21.910553746 +0100
--- q77_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 4,63 ****
sum(ss_net_profit) AS profit
FROM "${database}"."${schema}".store_sales,
"${database}"."${schema}".date_dim,
"${database}"."${schema}".store
WHERE ss_sold_date_sk = d_date_sk
! AND d_date BETWEEN cast('2000-08-18' AS date) AND (cast('2000-08-18' AS date) + 30 days)
*** q5.sql 2016-03-25 14:10:21.906553746 +0100
--- q5_modified.sql 2016-03-25 14:10:21.910553746 +0100
***************
*** 20,30 ****
sr_net_loss AS net_loss
FROM "${database}"."${schema}".store_returns) salesreturns,
"${database}"."${schema}".date_dim,
"${database}"."${schema}".store
WHERE date_sk = d_date_sk
! AND d_date BETWEEN cast('1999-08-16' AS date) AND (cast('1999-08-16' AS date) + 14 days)
*** q49.sql 2016-03-25 14:10:21.906553746 +0100
--- q49_modified.sql 2016-03-25 14:10:21.906553746 +0100
***************
*** 10,20 ****
rank() over (
ORDER BY return_ratio) AS return_rank,
rank() over (
ORDER BY currency_ratio) AS currency_rank
FROM
! (SELECT ws.ws_item_sk AS item ,(cast(sum(coalesce(wr.wr_return_quantity,0)) AS dec(15,4))/ cast(sum(coalesce(ws.ws_quantity,0)) AS dec(15,4))) AS return_ratio ,(cast(sum(coalesce(wr.wr_return_amt,0)) AS dec(15,4))/ cast(sum(coalesce(ws.ws_net_paid,0)) AS dec(15,4))) AS currency_ratio
*** q40.sql 2016-03-25 14:10:21.906553746 +0100
--- q40_modified.sql 2016-03-25 14:10:21.906553746 +0100
***************
*** 9,18 ****
"${database}"."${schema}".date_dim
WHERE i_current_price BETWEEN 0.99 AND 1.49
AND i_item_sk = cs_item_sk
AND cs_warehouse_sk = w_warehouse_sk
AND cs_sold_date_sk = d_date_sk
! AND d_date BETWEEN (CAST ('1998-03-31' AS date) - 30 days) AND (CAST ('1998-03-31' AS date) + 30 days)
*** q37.sql 2016-03-25 14:10:21.906553746 +0100
--- q37_modified.sql 2016-03-25 14:10:21.906553746 +0100
***************
*** 6,16 ****
"${database}"."${schema}".date_dim,
"${database}"."${schema}".catalog_sales
WHERE i_current_price BETWEEN 11 AND 11 + 30
AND inv_item_sk = i_item_sk
AND d_date_sk=inv_date_sk
! AND d_date BETWEEN cast('1998-01-05' AS date) AND (cast('1998-01-05' AS date) + 60 days)