Album » OptB » q8  (16 Slides)     [Page 1 of 1] :: Jump To  

select
    o_year,
    sum(case when
    nation = 'BRAZIL' then volume
    else 0 end) / sum(volume)
from
    (
        select
            extract(year from o_orderdate) as o_year,
            l_extendedprice * (1 - l_discount) as volume,
            n2.n_name as nation
        from
            part,
            supplier,
            lineitem,
            orders,
            customer,
            nation n1,
            nation n2,
            region
        where
            p_partkey = l_partkey
            and s_suppkey = l_suppkey
            and l_orderkey = o_orderkey
            and o_custkey = c_custkey
            and c_nationkey = n1.n_nationkey
            and n1.n_regionkey = r_regionkey
            and r_name = 'AMERICA'
            and s_nationkey = n2.n_nationkey
            and o_orderdate between date '1995-01-01' and date '1996-12-31'
            and p_type = 'ECONOMY ANODIZED STEEL'
            and s_acctbal :varies
            and l_extendedprice :varies
    )
group by
    o_year
order by
    o_year

  Up one level  
plan_diag * Plan Diagram * 1254 x 773 * (197KB)
reduced_diag * 1253 x 785 * (157KB)
cost_diag * Plan Cost Diagram * 1254 x 773 * (204KB)
card_diag * Plan Cardinality Diagram * 1254 x 773 * (204KB)
plan1 * PLAN 1 * 1243 x 867 * (51KB)
  plan_diag  
  reduced_diag  
  cost_diag  
  card_diag  
  plan1  
plan2 * PLAN 2 * 1243 x 867 * (55KB)
plan3 * PLAN 3 * 1243 x 867 * (52KB)
plan4 * PLAN 4 * 1243 x 867 * (56KB)
plan5 * PLAN 5 * 1243 x 867 * (60KB)
plan6 * PLAN 6 * 1243 x 867 * (56KB)
  plan2  
  plan3  
  plan4  
  plan5  
  plan6  
plan7 * PLAN 7 * 1243 x 867 * (66KB)
plan8 * PLAN 8 * 1243 x 867 * (68KB)
plan9 * PLAN 9 * 1243 x 867 * (64KB)
plan10 * PLAN 10 * 1243 x 867 * (68KB)
plan11 * PLAN 11 * 1243 x 867 * (74KB)
  plan7  
  plan8  
  plan9  
  plan10  
  plan11  
plan12 * PLAN 12 * 1243 x 867 * (69KB)
  plan12  
Album last updated on 5/19/07 12:53 AM
Powered by JAlbum 7.1 and BluPlusPlus skin