| ==== |
| ---- QUERY: TPCDS-Q56 |
| with ss as ( |
| select i_item_id,sum(ss_ext_sales_price) total_sales |
| from |
| store_sales, |
| date_dim, |
| customer_address, |
| item |
| where i_item_id in (select |
| i_item_id |
| from item |
| where i_color in ('slate','blanched','burnished')) |
| and ss_item_sk = i_item_sk |
| and ss_sold_date_sk = d_date_sk |
| and d_year = 2001 |
| and d_moy = 2 |
| and ss_addr_sk = ca_address_sk |
| and ca_gmt_offset = -5 |
| group by i_item_id), |
| cs as ( |
| select i_item_id,sum(cs_ext_sales_price) total_sales |
| from |
| catalog_sales, |
| date_dim, |
| customer_address, |
| item |
| where |
| i_item_id in (select |
| i_item_id |
| from item |
| where i_color in ('slate','blanched','burnished')) |
| and cs_item_sk = i_item_sk |
| and cs_sold_date_sk = d_date_sk |
| and d_year = 2001 |
| and d_moy = 2 |
| and cs_bill_addr_sk = ca_address_sk |
| and ca_gmt_offset = -5 |
| group by i_item_id), |
| ws as ( |
| select i_item_id,sum(ws_ext_sales_price) total_sales |
| from |
| web_sales, |
| date_dim, |
| customer_address, |
| item |
| where |
| i_item_id in (select |
| i_item_id |
| from item |
| where i_color in ('slate','blanched','burnished')) |
| and ws_item_sk = i_item_sk |
| and ws_sold_date_sk = d_date_sk |
| and d_year = 2001 |
| and d_moy = 2 |
| and ws_bill_addr_sk = ca_address_sk |
| and ca_gmt_offset = -5 |
| group by i_item_id) |
| select i_item_id ,sum(total_sales) total_sales |
| from (select * from ss |
| union all |
| select * from cs |
| union all |
| select * from ws) tmp1 |
| group by i_item_id |
| order by total_sales, i_item_id |
| limit 100; |
| ---- RESULTS |
| 'AAAAAAAACENDAAAA',0.00 |
| 'AAAAAAAAEPDEAAAA',0.00 |
| 'AAAAAAAAIGBEAAAA',0.00 |
| 'AAAAAAAAFBGBAAAA',3.52 |
| 'AAAAAAAAINHBAAAA',7.28 |
| 'AAAAAAAAMBGAAAAA',8.52 |
| 'AAAAAAAAEOIDAAAA',14.02 |
| 'AAAAAAAAALIBAAAA',48.62 |
| 'AAAAAAAAEDDAAAAA',48.80 |
| 'AAAAAAAAHOBDAAAA',49.50 |
| 'AAAAAAAAMGCCAAAA',51.84 |
| 'AAAAAAAAGBEAAAAA',54.53 |
| 'AAAAAAAACKAEAAAA',66.30 |
| 'AAAAAAAAKHOAAAAA',72.72 |
| 'AAAAAAAANFPBAAAA',74.48 |
| 'AAAAAAAAOFMBAAAA',83.22 |
| 'AAAAAAAAKHMCAAAA',105.44 |
| 'AAAAAAAAFOCEAAAA',105.98 |
| 'AAAAAAAAENCBAAAA',109.20 |
| 'AAAAAAAANGIBAAAA',111.00 |
| 'AAAAAAAADGDEAAAA',121.74 |
| 'AAAAAAAAEPADAAAA',126.08 |
| 'AAAAAAAAINHAAAAA',127.92 |
| 'AAAAAAAAHKJCAAAA',129.84 |
| 'AAAAAAAAOLFBAAAA',132.16 |
| 'AAAAAAAAPLEBAAAA',135.34 |
| 'AAAAAAAAOHKDAAAA',136.36 |
| 'AAAAAAAAEHOAAAAA',153.54 |
| 'AAAAAAAAGJABAAAA',172.50 |
| 'AAAAAAAAOCCBAAAA',200.93 |
| 'AAAAAAAAGGFAAAAA',235.20 |
| 'AAAAAAAAKIKBAAAA',236.95 |
| 'AAAAAAAAMIOBAAAA',238.92 |
| 'AAAAAAAAIPODAAAA',240.96 |
| 'AAAAAAAACPDCAAAA',265.33 |
| 'AAAAAAAAMKCEAAAA',268.37 |
| 'AAAAAAAAKMPAAAAA',283.53 |
| 'AAAAAAAACIBAAAAA',297.76 |
| 'AAAAAAAAEIACAAAA',332.80 |
| 'AAAAAAAAOGEEAAAA',339.65 |
| 'AAAAAAAAMFMDAAAA',351.12 |
| 'AAAAAAAAGHBCAAAA',359.90 |
| 'AAAAAAAAIGDCAAAA',371.79 |
| 'AAAAAAAACHLCAAAA',410.56 |
| 'AAAAAAAAGMBDAAAA',418.46 |
| 'AAAAAAAAIJMCAAAA',422.10 |
| 'AAAAAAAAEJLBAAAA',442.50 |
| 'AAAAAAAANDHCAAAA',460.07 |
| 'AAAAAAAAAFNBAAAA',460.32 |
| 'AAAAAAAAKDGDAAAA',479.88 |
| 'AAAAAAAAKKNCAAAA',494.48 |
| 'AAAAAAAAJAJBAAAA',518.30 |
| 'AAAAAAAACCOBAAAA',522.92 |
| 'AAAAAAAAAEKAAAAA',525.52 |
| 'AAAAAAAAKJBDAAAA',527.15 |
| 'AAAAAAAAGHEDAAAA',538.85 |
| 'AAAAAAAAACGCAAAA',562.68 |
| 'AAAAAAAAAEGAAAAA',572.32 |
| 'AAAAAAAAEKLBAAAA',572.32 |
| 'AAAAAAAAAHCBAAAA',604.38 |
| 'AAAAAAAALFADAAAA',606.67 |
| 'AAAAAAAAKFNDAAAA',617.96 |
| 'AAAAAAAAOEKAAAAA',619.39 |
| 'AAAAAAAAEEBEAAAA',626.40 |
| 'AAAAAAAAKMBCAAAA',628.95 |
| 'AAAAAAAAJHGDAAAA',631.81 |
| 'AAAAAAAAOMLDAAAA',631.89 |
| 'AAAAAAAAGNDDAAAA',645.99 |
| 'AAAAAAAAEADAAAAA',648.20 |
| 'AAAAAAAAKPKCAAAA',651.42 |
| 'AAAAAAAAAKHCAAAA',657.04 |
| 'AAAAAAAAOEIDAAAA',660.24 |
| 'AAAAAAAAMKAEAAAA',691.02 |
| 'AAAAAAAABLKAAAAA',691.26 |
| 'AAAAAAAADEIBAAAA',726.72 |
| 'AAAAAAAAKBHCAAAA',730.20 |
| 'AAAAAAAADNJAAAAA',731.92 |
| 'AAAAAAAAOFPBAAAA',737.28 |
| 'AAAAAAAACPIBAAAA',737.64 |
| 'AAAAAAAAEPPBAAAA',759.36 |
| 'AAAAAAAALNHDAAAA',761.60 |
| 'AAAAAAAAGKPDAAAA',773.56 |
| 'AAAAAAAAKBCAAAAA',775.30 |
| 'AAAAAAAAIBOCAAAA',777.48 |
| 'AAAAAAAAOJBEAAAA',777.84 |
| 'AAAAAAAAKFKBAAAA',780.41 |
| 'AAAAAAAAPJCCAAAA',783.00 |
| 'AAAAAAAACAKBAAAA',800.27 |
| 'AAAAAAAAOFNDAAAA',806.19 |
| 'AAAAAAAAGLIDAAAA',843.75 |
| 'AAAAAAAAGDBAAAAA',868.77 |
| 'AAAAAAAAOGFDAAAA',887.30 |
| 'AAAAAAAACOLBAAAA',918.96 |
| 'AAAAAAAAFFNCAAAA',923.35 |
| 'AAAAAAAACCJDAAAA',955.08 |
| 'AAAAAAAAMMCAAAAA',959.76 |
| 'AAAAAAAACCPDAAAA',971.77 |
| 'AAAAAAAAKNCEAAAA',998.60 |
| 'AAAAAAAACNACAAAA',1010.70 |
| 'AAAAAAAAKDEAAAAA',1019.52 |
| ---- TYPES |
| STRING, DECIMAL |
| ==== |