Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create view revenue0 (supplier_no, total_revenue) as
- select
- l_suppkey,
- sum(l_extendedprice * (1 - l_discount))
- from
- lineitem
- where
- l_shipdate >= date '1997-05-01'
- and l_shipdate < dateadd(month, 3, date '1997-05-01')
- group by
- l_suppkey;
- select
- s_suppkey,
- s_name,
- s_address,
- s_phone,
- total_revenue
- from
- supplier,
- revenue0
- where
- s_suppkey = supplier_no
- and total_revenue = (
- select
- max(total_revenue)
- from
- revenue0
- )
- order by
- s_suppkey;
Add Comment
Please, Sign In to add comment