Album » OptD » q7  (15 Slides)     [Page 1 of 1] :: Jump To  
select
    supp_nation,
    cust_nation,
    l_year,
    sum(volume) as revenue
from
    (
        select
            n1.n_name as supp_nation,
            n2.n_name as cust_nation,
            DATE_PART('YEAR',l_shipdate) as l_year,
            l_extendedprice * (1 - l_discount) as volume
        from
            supplier,
            lineitem,
            orders,
            customer,
            nation n1,
            nation n2
        where
            s_suppkey = l_suppkey
            and o_orderkey = l_orderkey
            and c_custkey = o_custkey
            and s_nationkey = n1.n_nationkey
            and c_nationkey = n2.n_nationkey
            and (
                (n1.n_name = 'FRANCE' and n2.n_name = 'GERMANY')
                or (n1.n_name = 'GERMANY' and n2.n_name = 'FRANCE')
            )
            and l_shipdate between '1995-01-01' and '1996-12-31'
            and o_totalprice :varies
            and c_acctbal :varies
    ) as shipping
group by
    supp_nation,
    cust_nation,
    l_year
order by
    supp_nation,
    cust_nation,
    l_year

  Up one level  
plan_diag * Plan Diagram * 1252 x 786 * (204KB)
reduced_diag * 1258 x 781 * (150KB)
cost_diag * Plan Cost Diagram * 1252 x 786 * (218KB)
card_diag * Plan Cardinality Diagram * 1252 x 786 * (209KB)
plan1 * PLAN 1 * 1256 x 870 * (40KB)
  plan_diag  
  reduced_diag  
  cost_diag  
  card_diag  
  plan1  
plan2 * PLAN 2 * 1256 x 870 * (40KB)
plan3 * PLAN 3 * 1256 x 870 * (40KB)
plan4 * PLAN 4 * 1256 x 870 * (40KB)
plan5 * PLAN 5 * 1256 x 870 * (40KB)
plan6 * PLAN 6 * 1256 x 870 * (40KB)
  plan2  
  plan3  
  plan4  
  plan5  
  plan6  
plan7 * PLAN 7 * 1256 x 870 * (39KB)
plan8 * PLAN 8 * 1256 x 870 * (39KB)
plan9 * PLAN 9 * 1256 x 870 * (40KB)
plan10 * PLAN 10 * 1256 x 870 * (41KB)
plan11 * PLAN 11 * 1256 x 870 * (40KB)
  plan7  
  plan8  
  plan9  
  plan10  
  plan11  
Album last updated on 5/19/07 1:05 AM
Powered by JAlbum 7.1 and BluPlusPlus skin