pdbench/MayBMS-tpch/query3.sql

2 lines
6.1 KiB
SQL

create table res as select n_name,n_name2 from (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2,U1.C3 as C3, U1.W3 as W3,U1.C4 as C4, U1.W4 as W4,U1.C5 as C5, U1.W5 as W5,U1.C6 as C6, U1.W6 as W6,U1.C7 as C7, U1.W7 as W7, U2.C1 as C8,U2.W1 as W8,U2.C2 as C9, U2.W2 as W9,U2.C3 as C10, U2.W3 as W10,U2.C4 as C11, U2.W4 as W11,U2.C5 as C12, U2.W5 as W12,U1.n_name,U2.n_name as n_name2,lineitem_tid, supplier_tid, U1.nation_tid, customer_tid, orders_tid, U2.nation_tid as nation_tid2 from (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2,U1.C3 as C3, U1.W3 as W3,U1.C4 as C4, U1.W4 as W4,U1.C5 as C5, U1.W5 as W5,U1.C6 as C6, U1.W6 as W6, U2.C1 as C7,U2.W1 as W7,n_name,orders_tid, lineitem_tid, supplier_tid, nation_tid from (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2,U1.C3 as C3, U1.W3 as W3,U1.C4 as C4, U1.W4 as W4, U2.C1 as C5,U2.W1 as W5,U2.C2 as C6, U2.W2 as W6,orders_tid, lineitem_tid, supplier_tid, nation_tid from (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2, U2.C1 as C3,U2.W1 as W3,U2.C2 as C4, U2.W2 as W4,supplier_tid, orders_tid, lineitem_tid from (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,supplier_tid, lineitem_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,s_suppkey,l_suppkey,supplier_tid, lineitem_tid from (select C1, W1, tid as supplier_tid, s_suppkey from U_s_suppkey) as U1, (select C1, W1, tid as lineitem_tid, l_suppkey from U_l_suppkey) as U2 where U1.s_suppkey=U2.l_suppkey and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) U) as U1 join (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,orders_tid, lineitem_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,o_orderkey,l_orderkey,orders_tid, lineitem_tid from (select C1, W1, tid as orders_tid, o_orderkey from U_o_orderkey) as U1, (select C1, W1, tid as lineitem_tid, l_orderkey from U_l_orderkey) as U2 where U1.o_orderkey=U2.l_orderkey and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) U) as U2 using (lineitem_tid) where (U1.C2 <> U2.C2 or U1.W2 = U2.W2) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C2 or U1.W1 = U2.W2) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1 join (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,supplier_tid, nation_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,s_nationkey,n_nationkey,supplier_tid, nation_tid from (select C1, W1, tid as supplier_tid, s_nationkey from U_s_nationkey) as U1, (select C1, W1, tid as nation_tid, n_nationkey from U_n_nationkey) as U2 where U1.s_nationkey=U2.n_nationkey and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) U) as U2 using (supplier_tid) where (U1.C4 <> U2.C2 or U1.W4 = U2.W2) and (U1.C4 <> U2.C1 or U1.W4 = U2.W1) and (U1.C3 <> U2.C2 or U1.W3 = U2.W2) and (U1.C3 <> U2.C1 or U1.W3 = U2.W1) and (U1.C2 <> U2.C2 or U1.W2 = U2.W2) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C2 or U1.W1 = U2.W2) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1 join (select * from (select C1, W1, tid as nation_tid, n_name from U_n_name) as X4 where n_name = 'GERMANY') as U2 using (nation_tid) where (U1.C6 <> U2.C1 or U1.W6 = U2.W1) and (U1.C5 <> U2.C1 or U1.W5 = U2.W1) and (U1.C4 <> U2.C1 or U1.W4 = U2.W1) and (U1.C3 <> U2.C1 or U1.W3 = U2.W1) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1 join (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2,U1.C3 as C3, U1.W3 as W3,U1.C4 as C4, U1.W4 as W4, U2.C1 as C5,U2.W1 as W5,n_name,nation_tid, customer_tid, orders_tid from (select U1.C1 as C1,U1.W1 as W1,U1.C2 as C2, U1.W2 as W2, U2.C1 as C3,U2.W1 as W3,U2.C2 as C4, U2.W2 as W4,nation_tid, customer_tid, orders_tid from (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,customer_tid, nation_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,c_nationkey,n_nationkey,customer_tid, nation_tid from (select C1, W1, tid as customer_tid, c_nationkey from U_c_nationkey) as U1, (select C1, W1, tid as nation_tid, n_nationkey from U_n_nationkey) as U2 where U1.c_nationkey=U2.n_nationkey and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) U) as U1 join (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,customer_tid, orders_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,c_custkey,o_custkey,customer_tid, orders_tid from (select C1, W1, tid as customer_tid, c_custkey from U_c_custkey) as U1, (select C1, W1, tid as orders_tid, o_custkey from U_o_custkey) as U2 where U1.c_custkey=U2.o_custkey and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) U) as U2 using (customer_tid) where (U1.C2 <> U2.C2 or U1.W2 = U2.W2) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C2 or U1.W1 = U2.W2) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1 join (select * from (select C1, W1, tid as nation_tid, n_name from U_n_name) as X5 where n_name = 'IRAQ') as U2 using (nation_tid) where (U1.C4 <> U2.C1 or U1.W4 = U2.W1) and (U1.C3 <> U2.C1 or U1.W3 = U2.W1) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U2 using (orders_tid) where (U1.C7 <> U2.C5 or U1.W7 = U2.W5) and (U1.C7 <> U2.C4 or U1.W7 = U2.W4) and (U1.C7 <> U2.C3 or U1.W7 = U2.W3) and (U1.C7 <> U2.C2 or U1.W7 = U2.W2) and (U1.C7 <> U2.C1 or U1.W7 = U2.W1) and (U1.C6 <> U2.C5 or U1.W6 = U2.W5) and (U1.C6 <> U2.C4 or U1.W6 = U2.W4) and (U1.C6 <> U2.C3 or U1.W6 = U2.W3) and (U1.C6 <> U2.C2 or U1.W6 = U2.W2) and (U1.C6 <> U2.C1 or U1.W6 = U2.W1) and (U1.C5 <> U2.C5 or U1.W5 = U2.W5) and (U1.C5 <> U2.C4 or U1.W5 = U2.W4) and (U1.C5 <> U2.C3 or U1.W5 = U2.W3) and (U1.C5 <> U2.C2 or U1.W5 = U2.W2) and (U1.C5 <> U2.C1 or U1.W5 = U2.W1) and (U1.C4 <> U2.C5 or U1.W4 = U2.W5) and (U1.C4 <> U2.C4 or U1.W4 = U2.W4) and (U1.C4 <> U2.C3 or U1.W4 = U2.W3) and (U1.C4 <> U2.C2 or U1.W4 = U2.W2) and (U1.C4 <> U2.C1 or U1.W4 = U2.W1) and (U1.C3 <> U2.C5 or U1.W3 = U2.W5) and (U1.C3 <> U2.C4 or U1.W3 = U2.W4) and (U1.C3 <> U2.C3 or U1.W3 = U2.W3) and (U1.C3 <> U2.C2 or U1.W3 = U2.W2) and (U1.C3 <> U2.C1 or U1.W3 = U2.W1) and (U1.C2 <> U2.C5 or U1.W2 = U2.W5) and (U1.C2 <> U2.C4 or U1.W2 = U2.W4) and (U1.C2 <> U2.C3 or U1.W2 = U2.W3) and (U1.C2 <> U2.C2 or U1.W2 = U2.W2) and (U1.C2 <> U2.C1 or U1.W2 = U2.W1) and (U1.C1 <> U2.C5 or U1.W1 = U2.W5) and (U1.C1 <> U2.C4 or U1.W1 = U2.W4) and (U1.C1 <> U2.C3 or U1.W1 = U2.W3) and (U1.C1 <> U2.C2 or U1.W1 = U2.W2) and (U1.C1 <> U2.C1 or U1.W1 = U2.W1))X6;