tpch_query5.sql 439 B

123456789101112131415161718192021222324
  1. select
  2. n_name,
  3. sum(l_extendedprice * (1 - l_discount)) as revenue
  4. from
  5. customer,
  6. orders,
  7. lineitem,
  8. supplier,
  9. nation,
  10. region
  11. where
  12. c_custkey = o_custkey
  13. and l_orderkey = o_orderkey
  14. and l_suppkey = s_suppkey
  15. and c_nationkey = s_nationkey
  16. and s_nationkey = n_nationkey
  17. and n_regionkey = r_regionkey
  18. and r_name = 'AFRICA'
  19. and o_orderdate >= '1993-01-01'
  20. and o_orderdate < '1994-01-01'
  21. group by
  22. n_name
  23. order by
  24. revenue desc;