Guest User

Untitled

a guest
Dec 12th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. create view revenue0 (supplier_no, total_revenue) as
  2. select
  3. l_suppkey,
  4. sum(l_extendedprice * (1 - l_discount))
  5. from
  6. lineitem
  7. where
  8. l_shipdate >= date '1997-05-01'
  9. and l_shipdate < dateadd(month, 3, date '1997-05-01')
  10. group by
  11. l_suppkey;
  12.  
  13. select
  14. s_suppkey,
  15. s_name,
  16. s_address,
  17. s_phone,
  18. total_revenue
  19. from
  20. supplier,
  21. revenue0
  22. where
  23. s_suppkey = supplier_no
  24. and total_revenue = (
  25. select
  26. max(total_revenue)
  27. from
  28. revenue0
  29. )
  30. order by
  31. s_suppkey;
Add Comment
Please, Sign In to add comment