1
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union all (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
9
select * from ((select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union all (select /*+index(t1 i1) */ pk1,c1 from t2 where c1 > 10 order by c1) ) a order by pk1, a.c1;
18
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) union (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
24
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) except (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
26
(select /*+index(t1 i1) */ pk1,c1 from t1 where c1<30 order by c1) intersect (select /*+index(t1 i1) */ pk1,c1 from t1 where c1 > 10 order by c1);
30
(select c1,c2,c3 from t1 where c1=11 order by c2) union (select c1,c2,c3 from t1 where c1=22 and c2 like 'column3_' order by c1) union distinct select c1,c2,c3 from t1 where c1>22 and c2 is not null and c3>='2013-12-11 11:11:11' union all (select c1,c2,c3 from t1 where c4<2 and c5>1 and c6=3 order by c4) except (select c1,c2,c3 from t1 where c3 <= '2013-12-11 11:11:11' order by c3);
32
11 column42 2013-12-11 11:11:14.000000
33
22 column32 2013-12-11 11:11:13.000000
34
33 column21 2013-12-11 11:11:12.000000
35
select * from ((select * from t1 where c1=44) union (select * from t1 where c1=33 and c2 like 'column%') union all (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
36
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
37
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
38
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
39
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
40
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
41
select * from ((select * from t1 where c1=44) union all (select * from t1 where c1=33 and c2 like 'column%') except (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
42
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
43
select * from ((select * from t1 where c1=44) intersect (select * from t1 where c1=33 and c2 like 'column%') union all (select * from t1 where c4>2 and c5<3 and c6 != 2)) as a;
44
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
45
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
46
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
47
(select c1,c4 from t1 where c1 in (33,11) order by c1) union all select c1,c4 from t1 where c1=44;
52
(select c1,c4 from t1 where c1 in (1,44) order by c1) union all (select c1,c4 from t1 where c1 in (33,11) order by c1);
57
(select c1,c4 from t1 where c1 in (1,44) order by c1) union all (select c1,c4 from t1 where c1 =33 order by c4);
61
select c1,c4 from t1 where c1=44 union (select c1,c4 from t1 where c1 not in (33,11) order by c1);
65
(select c1,c4 from t1 where c1 not in (33,11) order by c1) except select c1,c4 from t1 where c1=44;
68
(select c1,c4 from t1 where c1 not in (33,11) order by c1) intersect select c1,c4 from t1 where c1=44;
71
(select c4,c5,c6 from t1 order by c1 limit 2) union all (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
76
(select c4,c5,c6 from t1 order by c4 limit 2) union (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
80
(select c4,c5,c6 from t1 order by c2 limit 2) except (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
84
(select c4,c5,c6 from t1 order by c4 limit 2) intersect (select c4,c5,c6 from t1 order by c4 limit 1) order by c4 desc;
87
select /*+index(t1 i1)*/ pk1,c1 from t1 union select /*+index(t2 i11)*/ pk1,c1 from t2;
96
select /*+index(t1 i1)*/ pk1,c1 from t1 union all select /*+index(t2 i11)*/ pk1,c1 from t2;
108
select /*+index(t1 i1)*/ pk1,c1 from t1 except select /*+index(t2 i11)*/ pk1,c1 from t2;
111
select /*+index(t1 i1)*/ pk1,c1 from t1 intersect select /*+index(t2 i11)*/ pk1,c1 from t2;
116
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1) union (select c1,c4 from t2 where c1=44 order by c1);
123
(select c1,c4 from t2 where c1=44 order by c1) union (select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1);
130
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t2.c1) union all (select c1,c4 from t2 where c1=44 order by c1);
138
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t1.c1) except (select c1,c4 from t2 where c1=44 order by c2);
144
(select t1.c1,t2.c4 from t1,t2 where t1.c1=t2.c1 order by t2.c1) intersect (select c1,c4 from t2 where c1=44 order by c1);
147
select * from (select * from t1 where pk1 in(1,2,3,4,5,6)) a order by pk2;
148
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
149
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
150
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
151
3 primarykey3 2013-12-11 01:01:03.000000 22 column32 2013-12-11 11:11:13.000000 2 1 2
152
4 primarykey4 2013-12-11 01:01:04.000000 11 column42 2013-12-11 11:11:14.000000 1 3 2
153
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a order by pk2;
154
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
155
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
156
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
157
3 primarykey3 2013-12-11 01:01:03.000000 22 column32 2013-12-11 11:11:13.000000 2 1 2
158
4 primarykey4 2013-12-11 01:01:04.000000 11 column42 2013-12-11 11:11:14.000000 1 3 2
159
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a order by pk1;
160
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
161
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
162
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
163
3 primarykey3 2013-12-11 01:01:03.000000 22 column32 2013-12-11 11:11:13.000000 2 1 2
164
4 primarykey4 2013-12-11 01:01:04.000000 11 column42 2013-12-11 11:11:14.000000 1 3 2
165
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a where a.c2>='abc' order by pk1;
166
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
167
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
168
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
169
3 primarykey3 2013-12-11 01:01:03.000000 22 column32 2013-12-11 11:11:13.000000 2 1 2
170
4 primarykey4 2013-12-11 01:01:04.000000 11 column42 2013-12-11 11:11:14.000000 1 3 2
171
select * from (select * from t1 where pk1 in(1,2,3,4,5,6) order by pk1) a where a.c2>='abc' order by pk2;
172
pk1 pk2 pk3 c1 c2 c3 c4 c5 c6
173
1 primarykey1 2013-12-11 01:01:01.000000 44 column11 2013-12-11 11:11:11.000000 4 2 3
174
2 primarykey2 2013-12-11 01:01:02.000000 33 column21 2013-12-11 11:11:12.000000 3 1 3
175
3 primarykey3 2013-12-11 01:01:03.000000 22 column32 2013-12-11 11:11:13.000000 2 1 2
176
4 primarykey4 2013-12-11 01:01:04.000000 11 column42 2013-12-11 11:11:14.000000 1 3 2