q90.sql 1.2 KB

12345678910111213141516171819202122232425
  1. --!syntax_pg
  2. --TPC-DS Q90
  3. -- start query 1 in stream 0 using template ../query_templates/query90.tpl
  4. select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio
  5. from ( select count(*) amc
  6. from plato.web_sales, plato.household_demographics , plato.time_dim, plato.web_page
  7. where ws_sold_time_sk = time_dim.t_time_sk
  8. and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
  9. and ws_web_page_sk = web_page.wp_web_page_sk
  10. and time_dim.t_hour between 6 and 6+1
  11. and household_demographics.hd_dep_count = 8
  12. and web_page.wp_char_count between 5000 and 5200) at,
  13. ( select 1 + count(*) pmc
  14. from plato.web_sales, plato.household_demographics , plato.time_dim, plato.web_page
  15. where ws_sold_time_sk = time_dim.t_time_sk
  16. and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
  17. and ws_web_page_sk = web_page.wp_web_page_sk
  18. and time_dim.t_hour between 14 and 14+1
  19. and household_demographics.hd_dep_count = 8
  20. and web_page.wp_char_count between 5000 and 5200) pt
  21. order by am_pm_ratio
  22. limit 100;
  23. -- end query 1 in stream 0 using template ../query_templates/query90.tpl