query84.sql 740 B

123456789101112131415161718192021
  1. select c_customer_id as customer_id
  2. ,concat(c_last_name, ', ', c_first_name) as customername
  3. from customer
  4. ,customer_address
  5. ,customer_demographics
  6. ,household_demographics
  7. ,income_band
  8. ,store_returns
  9. where ca_city = 'Hopewell'
  10. and customer.c_current_addr_sk = customer_address.ca_address_sk
  11. and ib_lower_bound >= 32287
  12. and ib_upper_bound <= 32287 + 50000
  13. and income_band.ib_income_band_sk = household_demographics.hd_income_band_sk
  14. and customer_demographics.cd_demo_sk = customer.c_current_cdemo_sk
  15. and household_demographics.hd_demo_sk = customer.c_current_hdemo_sk
  16. and store_returns.sr_cdemo_sk = customer_demographics.cd_demo_sk
  17. order by customer_id
  18. limit 100;