Album » OptA » q7  (14 Slides)     [Page 1 of 1] :: Jump To  
Query Template

select
    supp_nation,
    cust_nation,
    l_year,
    sum(volume)
from
    (
    select
    n1.n_name as supp_nation, n2.n_name as cust_nation, 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

Pictures
  Up one level  
plan_diag * Plan Diagram * 1277 x 769 * (195KB)
reduced_diag * 1255 x 773 * (159KB)
cost_diag * Plan Cost Diagram * 1277 x 769 * (207KB)
card_diag * Plan Cardinality Diagram * 1277 x 769 * (205KB)
plan1 * PLAN 1 * 1252 x 871 * (49KB)
  plan_diag  
  reduced_diag  
  cost_diag  
  card_diag  
  plan1  
plan2 * PLAN 2 * 1252 x 871 * (52KB)
plan3 * PLAN 3 * 1252 x 871 * (52KB)
plan4 * PLAN 4 * 1252 x 871 * (50KB)
plan5 * PLAN 5 * 1252 x 871 * (52KB)
plan6 * PLAN 6 * 1252 x 871 * (54KB)
  plan2  
  plan3  
  plan4  
  plan5  
  plan6  
plan7 * PLAN 7 * 1252 x 871 * (47KB)
plan8 * PLAN 8 * 1252 x 871 * (52KB)
plan9 * PLAN 9 * 1252 x 871 * (45KB)
plan10 * PLAN 10 * 1252 x 871 * (58KB)
  plan7  
  plan8  
  plan9  
  plan10  
Album last updated on 5/19/07 12:47 AM
Powered by JAlbum 7.1 and BluPlusPlus skin