query35.sql 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. -- start query 1 in stream 0 using template query35.tpl and seed 1930872976
  2. select
  3. ca_state,
  4. cd_gender,
  5. cd_marital_status,
  6. cd_dep_count,
  7. count(*) cnt1,
  8. avg(cd_dep_count),
  9. min(cd_dep_count),
  10. stddev_samp(cd_dep_count),
  11. cd_dep_employed_count,
  12. count(*) cnt2,
  13. avg(cd_dep_employed_count),
  14. min(cd_dep_employed_count),
  15. stddev_samp(cd_dep_employed_count),
  16. cd_dep_college_count,
  17. count(*) cnt3,
  18. avg(cd_dep_college_count),
  19. min(cd_dep_college_count),
  20. stddev_samp(cd_dep_college_count)
  21. from
  22. customer c,customer_address ca,customer_demographics
  23. where
  24. c.c_current_addr_sk = ca.ca_address_sk and
  25. cd_demo_sk = c.c_current_cdemo_sk and
  26. exists (select *
  27. from store_sales,date_dim
  28. where c.c_customer_sk = ss_customer_sk and
  29. ss_sold_date_sk = d_date_sk and
  30. d_year = 2001 and
  31. d_qoy < 4) and
  32. (exists (select *
  33. from web_sales,date_dim
  34. where c.c_customer_sk = ws_bill_customer_sk and
  35. ws_sold_date_sk = d_date_sk and
  36. d_year = 2001 and
  37. d_qoy < 4) or
  38. exists (select *
  39. from catalog_sales,date_dim
  40. where c.c_customer_sk = cs_ship_customer_sk and
  41. cs_sold_date_sk = d_date_sk and
  42. d_year = 2001 and
  43. d_qoy < 4))
  44. group by ca_state,
  45. cd_gender,
  46. cd_marital_status,
  47. cd_dep_count,
  48. cd_dep_employed_count,
  49. cd_dep_college_count
  50. order by ca_state,
  51. cd_gender,
  52. cd_marital_status,
  53. cd_dep_count,
  54. cd_dep_employed_count,
  55. cd_dep_college_count
  56. limit 100;
  57. -- end query 1 in stream 0 using template query35.tpl