query10.sql 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. -- start query 1 in stream 0 using template query10.tpl and seed 797269820
  2. select
  3. cd_gender,
  4. cd_marital_status,
  5. cd_education_status,
  6. count(*) cnt1,
  7. cd_purchase_estimate,
  8. count(*) cnt2,
  9. cd_credit_rating,
  10. count(*) cnt3,
  11. cd_dep_count,
  12. count(*) cnt4,
  13. cd_dep_employed_count,
  14. count(*) cnt5,
  15. cd_dep_college_count,
  16. count(*) cnt6
  17. from
  18. customer c,customer_address ca,customer_demographics
  19. where
  20. c.c_current_addr_sk = ca.ca_address_sk and
  21. ca_county in ('Fillmore County','McPherson County','Bonneville County','Boone County','Brown County') and
  22. cd_demo_sk = c.c_current_cdemo_sk and
  23. exists (select *
  24. from store_sales,date_dim
  25. where c.c_customer_sk = ss_customer_sk and
  26. ss_sold_date_sk = d_date_sk and
  27. d_year = 2000 and
  28. d_moy between 3 and 3+3) and
  29. (exists (select *
  30. from web_sales,date_dim
  31. where c.c_customer_sk = ws_bill_customer_sk and
  32. ws_sold_date_sk = d_date_sk and
  33. d_year = 2000 and
  34. d_moy between 3 ANd 3+3) or
  35. exists (select *
  36. from catalog_sales,date_dim
  37. where c.c_customer_sk = cs_ship_customer_sk and
  38. cs_sold_date_sk = d_date_sk and
  39. d_year = 2000 and
  40. d_moy between 3 and 3+3))
  41. group by cd_gender,
  42. cd_marital_status,
  43. cd_education_status,
  44. cd_purchase_estimate,
  45. cd_credit_rating,
  46. cd_dep_count,
  47. cd_dep_employed_count,
  48. cd_dep_college_count
  49. order by cd_gender,
  50. cd_marital_status,
  51. cd_education_status,
  52. cd_purchase_estimate,
  53. cd_credit_rating,
  54. cd_dep_count,
  55. cd_dep_employed_count,
  56. cd_dep_college_count
  57. limit 100;
  58. -- end query 1 in stream 0 using template query10.tpl