1
0

query69.sql 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. -- start query 1 in stream 0 using template query69.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. from
  12. customer c,customer_address ca,customer_demographics
  13. where
  14. c.c_current_addr_sk = ca.ca_address_sk and
  15. ca_state in ('MO','MN','AZ') and
  16. cd_demo_sk = c.c_current_cdemo_sk and
  17. exists (select *
  18. from store_sales,date_dim
  19. where c.c_customer_sk = ss_customer_sk and
  20. ss_sold_date_sk = d_date_sk and
  21. d_year = 2003 and
  22. d_moy between 2 and 2+2) and
  23. (not exists (select *
  24. from web_sales,date_dim
  25. where c.c_customer_sk = ws_bill_customer_sk and
  26. ws_sold_date_sk = d_date_sk and
  27. d_year = 2003 and
  28. d_moy between 2 and 2+2) and
  29. not exists (select *
  30. from catalog_sales,date_dim
  31. where c.c_customer_sk = cs_ship_customer_sk and
  32. cs_sold_date_sk = d_date_sk and
  33. d_year = 2003 and
  34. d_moy between 2 and 2+2))
  35. group by cd_gender,
  36. cd_marital_status,
  37. cd_education_status,
  38. cd_purchase_estimate,
  39. cd_credit_rating
  40. order by cd_gender,
  41. cd_marital_status,
  42. cd_education_status,
  43. cd_purchase_estimate,
  44. cd_credit_rating
  45. limit 100;
  46. -- end query 1 in stream 0 using template query69.tpl