0001
0002
0003 select
0004 c_custkey,
0005 c_name,
0006 sum(l_extendedprice * (1 - l_discount)) as revenue,
0007 c_acctbal,
0008 n_name,
0009 c_address,
0010 c_phone,
0011 c_comment
0012 from
0013 customer,
0014 orders,
0015 lineitem,
0016 nation
0017 where
0018 c_custkey = o_custkey
0019 and l_orderkey = o_orderkey
0020 and o_orderdate >= date '1993-10-01'
0021 and o_orderdate < date '1993-10-01' + interval '3' month
0022 and l_returnflag = 'R'
0023 and c_nationkey = n_nationkey
0024 group by
0025 c_custkey,
0026 c_name,
0027 c_acctbal,
0028 c_phone,
0029 n_name,
0030 c_address,
0031 c_comment
0032 order by
0033 revenue desc
0034 limit 20