-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqueries.plan
88 lines (56 loc) · 2.51 KB
/
queries.plan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
(q1)
SELECT SUM (ps.ps_supplycost), s.s_suppkey
FROM part AS p, supplier AS s, partsupp AS ps
WHERE (p.p_partkey = ps.ps_partkey) AND (s.s_suppkey = ps.ps_suppkey) AND (s.s_acctbal > 2500.0)
GROUP BY s.s_suppkey
(q2)
SELECT SUM (l.l_extendedprice * (1 - l.l_discount)), l.l_orderkey, o.o_orderdate, o.o_shippriority
FROM customer AS c, orders AS o, lineitem AS l
WHERE (c.c_mktsegment = 'BUILDING') AND (c.c_custkey = o.o_custkey) AND (l.l_orderkey = o.o_orderkey) AND (l.l_orderkey < 100 OR o.o_orderkey < 100)
GROUP BY l.l_orderkey, o.o_orderdate, o.o_shippriority
(q3)
SELECT l.l_orderkey, l.l_partkey, l.l_suppkey
FROM lineitem AS l
WHERE (l.l_returnflag = 'R') AND (l.l_discount < 0.04 OR l.l_shipmode = 'MAIL')
(q4)
SELECT DISTINCT c1.c_name, c1.c_address, c1.c_acctbal
FROM customer AS c1, customer AS c2
WHERE (c1.c_nationkey = c2.c_nationkey) AND (c1.c_name ='Customer#000070919')
(q5)
SELECT SUM(l.l_discount)
FROM customer AS c, orders AS o, lineitem AS l
WHERE (c.c_custkey = o.o_custkey) AND (o.o_orderkey = l.l_orderkey) AND (c.c_name = 'Customer#000070919') AND (l.l_quantity > 30.0) AND (l.l_discount < 0.03)
(q6)
SELECT l.l_orderkey
FROM lineitem AS l
WHERE (l.l_quantity > 30.0)
(q7)
SELECT DISTINCT c.c_name
FROM lineitem AS l, orders AS o, customer AS c, nation AS n, region AS r
WHERE (l.l_orderkey = o.o_orderkey) AND (o.o_custkey = c.c_custkey) AND (c.c_nationkey = n.n_nationkey) AND (n.n_regionkey = r.r_regionkey)
(q8)
SELECT l.l_discount
FROM lineitem AS l, orders AS o, customer AS c, nation AS n, region AS r
WHERE (l.l_orderkey = o.o_orderkey) AND (o.o_custkey = c.c_custkey) AND (c.c_nationkey = n.n_nationkey) AND (n.n_regionkey = r.r_regionkey) AND (r.r_regionkey = 1) AND (o.o_orderkey < 10000)
(q9)
SELECT SUM (l.l_discount)
FROM customer AS c, orders AS o, lineitem AS l
WHERE (c.c_custkey = o.o_custkey) AND (o.o_orderkey = l.l_orderkey) AND (c.c_name = 'Customer#000070919') AND (l.l_quantity > 30.0) AND (l.l_discount < 0.03)
(q10)
SELECT SUM (l.l_extendedprice * l.l_discount)
FROM lineitem AS l
WHERE (l.l_discount<0.07) AND (l.l_quantity < 24.0)
////////////////////////////////////////////////////////
Our Queries
(11)
SELECT c1.c_name, c1.c_address
FROM customer AS c1, customer AS c2
WHERE (c1.c_nationkey = c2.c_nationkey)
(12)
SELECT ps.ps_supplycost, s.suppkey
FROM supplier AS s, partsupp AS ps
WHERE (s.s_suppkey = ps.ps_suppkey) AND (s.s_acctbal > 2500.0)
(13)
SELECT n.n_name
FROM nation AS n, region AS r
WHERE (n.n_regionkey = r.r_regionkey) AND (n.n_nationkey > 5)