0001 select d_year, s_nation, p_category, sum(lo_revenue-lo_supplycost) as profit1
0002 from date, customer, supplier, part, lineorder
0003 where lo_custkey = c_custkey
0004 and lo_suppkey = s_suppkey
0005 and lo_partkey = p_partkey
0006 and lo_orderdate = d_datekey
0007 and c_region = 'AMERICA'
0008 and s_region = 'AMERICA'
0009 and (d_year = 1997 or d_year = 1998)
0010 and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
0011 group by d_year, s_nation, p_category
0012 order by d_year, s_nation, p_category