query9.sql 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. -- start query 1 in stream 0 using template query9.tpl and seed 1490436826
  2. select case when (select count(*)
  3. from store_sales
  4. where ss_quantity between 1 and 20) > 409437
  5. then (select avg(ss_ext_list_price)
  6. from store_sales
  7. where ss_quantity between 1 and 20)
  8. else (select avg(ss_net_paid_inc_tax)
  9. from store_sales
  10. where ss_quantity between 1 and 20) end bucket1 ,
  11. case when (select count(*)
  12. from store_sales
  13. where ss_quantity between 21 and 40) > 4595804
  14. then (select avg(ss_ext_list_price)
  15. from store_sales
  16. where ss_quantity between 21 and 40)
  17. else (select avg(ss_net_paid_inc_tax)
  18. from store_sales
  19. where ss_quantity between 21 and 40) end bucket2,
  20. case when (select count(*)
  21. from store_sales
  22. where ss_quantity between 41 and 60) > 7887297
  23. then (select avg(ss_ext_list_price)
  24. from store_sales
  25. where ss_quantity between 41 and 60)
  26. else (select avg(ss_net_paid_inc_tax)
  27. from store_sales
  28. where ss_quantity between 41 and 60) end bucket3,
  29. case when (select count(*)
  30. from store_sales
  31. where ss_quantity between 61 and 80) > 10872978
  32. then (select avg(ss_ext_list_price)
  33. from store_sales
  34. where ss_quantity between 61 and 80)
  35. else (select avg(ss_net_paid_inc_tax)
  36. from store_sales
  37. where ss_quantity between 61 and 80) end bucket4,
  38. case when (select count(*)
  39. from store_sales
  40. where ss_quantity between 81 and 100) > 43571537
  41. then (select avg(ss_ext_list_price)
  42. from store_sales
  43. where ss_quantity between 81 and 100)
  44. else (select avg(ss_net_paid_inc_tax)
  45. from store_sales
  46. where ss_quantity between 81 and 100) end bucket5
  47. from reason
  48. where r_reason_sk = 1
  49. ;
  50. -- end query 1 in stream 0 using template query9.tpl