Loading plan…
/* using 19620718 as a seed to the RNG */
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,
DATEPART(YEAR, l_shipdate) AS l_year,
l_extendedprice * (
1 - l_discount
) AS volume
FROM supplier, lineitem, orders, customer, nation AS n1, nation AS 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 = 'EGYPT' AND n2.n_name = 'ETHIOPIA'
)
OR (
n1.n_name = 'ETHIOPIA' AND n2.n_name = 'EGYPT'
)
)
AND l_shipdate BETWEEN CAST('1995-01-01' AS DATE) AND CAST('1996-12-31' AS DATE)
) AS shipping
GROUP BY
supp_nation,
cust_nation,
l_year
ORDER BY
supp_nation,
cust_nation,
l_year;
Step details
Loading plan…
Green: scan · yellow: join · purple: row movement. Rows and costs are optimiser estimates; costs use model units.