pdbench/MayBMS-tpch/query1.sql

3 lines
3.7 KiB
SQL

create table res as select l_orderkey,o_orderdate,o_shippriority 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,l_orderkey,o_orderdate,o_shippriority,lineitem_tid, customer_tid, orders_tid from (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,U.C3 as C3, U.W3 as W3,U.C4 as C4, U.W4 as W4,U.C5 as C5, U.W5 as W5,U.C6 as C6, U.W6 as W6,U.C7 as C7, U.W7 as W7,lineitem_tid, customer_tid, orders_tid,l_orderkey,o_orderdate 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,U2.C3 as C5, U2.W3 as W5,U2.C4 as C6, U2.W4 as W6,U2.C5 as C7, U2.W5 as W7,l_orderkey,o_orderdate,o_orderkey,lineitem_tid, customer_tid, orders_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,l_orderkey,lineitem_tid from (select C1, W1, tid as lineitem_tid, l_orderkey from U_l_orderkey) as U1 join (select U.C1 as C1,U.W1 as W1,lineitem_tid from (select * from (select C1, W1, tid as lineitem_tid, l_shipdate from U_l_shipdate) as X1 where l_shipdate < '1995-03-17') U) as U2 using (lineitem_tid) where (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1, (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,o_orderdate,o_orderkey,customer_tid, orders_tid from (select U.C1 as C1,U.W1 as W1,U.C2 as C2, U.W2 as W2,U.C3 as C3, U.W3 as W3,U.C4 as C4, U.W4 as W4,customer_tid, orders_tid,o_orderdate 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,c_custkey,o_custkey,o_orderdate,customer_tid, orders_tid from (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,c_custkey,customer_tid from (select C1, W1, tid as customer_tid, c_custkey from U_c_custkey) as U1 join (select U.C1 as C1,U.W1 as W1,customer_tid from (select * from (select C1, W1, tid as customer_tid, c_mktsegment from U_c_mktsegment) as X2 where c_mktsegment = 'BUILDING') U) as U2 using (customer_tid) where (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U1, (select U1.C1 as C1,U1.W1 as W1, U2.C1 as C2,U2.W1 as W2,o_custkey,o_orderdate,orders_tid from (select C1, W1, tid as orders_tid, o_custkey from U_o_custkey) as U1 join (select * from (select C1, W1, tid as orders_tid, o_orderdate from U_o_orderdate) as X3 where o_orderdate > '1995-03-15') as U2 using (orders_tid) where (U1.C1 <> U2.C1 or U1.W1 = U2.W1)) as U2 where U1.c_custkey=U2.o_custkey 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)) U) as U1 join (select C1, W1, tid as orders_tid, o_orderkey from U_o_orderkey) as U2 using (orders_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 where U1.l_orderkey=U2.o_orderkey 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)) U) as U1 join (select C1, W1, tid as orders_tid, o_shippriority from U_o_shippriority) as U2 using (orders_tid) where (U1.C7 <> U2.C1 or U1.W7 = U2.W1) and (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))X4;