Album » OptD » q9  (14 Slides)     [Page 1 of 1] :: Jump To  
select
    n_name,
    o_year,
    sum(amount) as sum_profit
from
    (
        select
            n_name,
            DATE_PART('YEAR',o_orderdate) as o_year,
            l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount
        from
            part,
            supplier,
            lineitem,
            partsupp,
            orders,
            nation
        where
            s_suppkey = l_suppkey
            and ps_suppkey = l_suppkey
            and ps_partkey = l_partkey
            and p_partkey = l_partkey
            and o_orderkey = l_orderkey
            and s_nationkey = n_nationkey
            and p_name like '%green%'
            and s_acctbal :varies
            and ps_supplycost :varies
    ) as profit
group by
    n_name,
    o_year
order by
    n_name,
    o_year desc

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