File: group_min_max_ext_test.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (155 lines) | stat: -rw-r--r-- 6,053 bytes parent folder | download
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Testing GROUP MIN/MAX with multiple infix ranges.
let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  =  WHERE (b = 2 OR b = 15 OR b = 3) AND (c = 3 OR c = 40) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b = 2 OR b = 15) AND (c = 3 OR c = 40) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b = 2 OR b = 15) AND (c = 3 OR c IS NULL) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b IS NULL OR b = 15) AND (c = 3 OR c = 40) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b IS NULL OR b = 2) AND (c = 3 OR c = 40) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a FROM t;
let $cond  = WHERE (b = 2 OR b = 15 OR b = 3) AND (c = 3 OR c = 40) GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b = 2 OR b = 15) AND (c = 3 OR c = 40) GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (b = 2 OR b = 15 OR b = 3) AND (c = 3 OR c = 40)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT DISTINCT a FROM t;
let $cond  = WHERE a = 1 AND (b = 2 OR b = 15);
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE a = 1 AND (c = 3 OR c = 40) AND (d = 1 OR d = 9)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

# Testing GROUP MIN/MAX with multiple prefix ranges and infix ranges.

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a = 1 OR a = 12) AND (b = 2 OR b = 15) AND (c = 3 OR c = 40)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a < 2 OR a > 11) AND (b = 2 OR b = 15) AND (c = 3 OR c = 40)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT DISTINCT a, b FROM t;
let $cond  = WHERE (a = 1 OR a = 12) AND (b = 2 OR b = 15) AND (c = 3 OR c = 40);
--source include/group_min_max_ext_query.inc

let $query = SELECT DISTINCT a FROM t;
let $cond  = WHERE (a = 1 OR a = 12) AND (b = 2 OR b = 15);
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a = 1 OR a = 12) AND (b < 4 OR b > 10) AND (c = 3 OR c = 40)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a = 1 OR a > 9) AND (b = 2 OR b = 15) AND (c = 3 OR c = 40)
             GROUP BY a;
--source include/group_min_max_ext_query.inc

let $query = SELECT COUNT(DISTINCT a, b) FROM t;
let $cond  = WHERE (a = 1 OR a = 12) AND (b = 2 OR b = 15) AND (c = 3 OR c = 40);
--source include/group_min_max_ext_query.inc

let $query = SELECT SUM(DISTINCT a), AVG(DISTINCT a) FROM t;
let $cond  = WHERE (b = 2 OR b = 15) AND (c = 3 OR c = 40);
--source include/group_min_max_ext_query.inc

let $query = SELECT SUM(DISTINCT a), AVG(DISTINCT a), COUNT(DISTINCT a) FROM t;
let $cond  = WHERE (b = 2 OR b = 15) AND (c = 3 OR c = 40);
--source include/group_min_max_ext_query.inc

# No group-by loose index scan due to cost.
let $query = SELECT a, MAX(d), MIN(d) FROM t;
let $cond = WHERE (a > 11) AND (b = 2 OR b = 15) AND
            (c = 3 OR c = 1 OR c = 2 OR c = 4)
            GROUP BY a;
--source include/group_min_max_ext_query.inc

# Testing GROUP MIN/MAX with multiple prefix ranges, infix ranges and
# min_max ranges.

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (c = 3 OR c = 40) AND (d  > 7 OR d =2) GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (c = 3 OR c = 40) AND (d  > 7 OR d =2 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MIN(d) FROM t;
let $cond  = WHERE (a > 5) AND (c = 3 OR c = 40) AND
             (d  < -24 OR d = 3 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a > 5) AND (c = 3 OR c = 40) AND (d  <  1 OR d = 9)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MAX(d), MIN(d) FROM t;
let $cond  = WHERE (a > 9) AND (c = 3 OR c = 40) AND
             (d  =  1 OR d = 9 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MIN(d), MAX(d) FROM t;
let $cond  = WHERE (a > 9) AND (c = 3 OR c = 40) AND
             (d  =  0 OR d = 9 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MIN(d), MAX(d) FROM t;
let $cond  = WHERE (a > 9) AND (c = 3 OR c = 40) AND
             (d  > 0 AND d < 2 OR d > 3 AND d < 5 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b, MIN(d) FROM t;
let $cond  = WHERE (a > 9) AND (c = 3 OR c = 40) AND
             (d < 2 OR d > 5 OR d IS NULL)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b , max(d) FROM t;
let $cond  = WHERE (a >= 10) AND (c = 3 or c=40) AND
             (d is NULL or d = -10 or d = -23)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

let $query = SELECT a, b , min(d) FROM t;
let $cond  = WHERE (a >= 10) AND (c = 3 or c=40) AND
             (d is NULL or d = -10 or d = -23)
             GROUP BY a, b;
--source include/group_min_max_ext_query.inc

# No prefix and min/max ranges
let $query = SELECT a, MIN(b), MAX(b) FROM t;
let $cond  = WHERE a > 9 GROUP BY a;
--source include/group_min_max_ext_query.inc