func_math.result 16.4 KB
Newer Older
1
drop table if exists t1;
unknown's avatar
unknown committed
2
select floor(5.5),floor(-5.5);
3 4
floor(5.5)	floor(-5.5)
5	-6
unknown's avatar
unknown committed
5
explain extended select floor(5.5),floor(-5.5);
6 7
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
8
Warnings:
unknown's avatar
unknown committed
9
Note	1003	select floor(5.5) AS `floor(5.5)`,floor(-(5.5)) AS `floor(-5.5)`
unknown's avatar
unknown committed
10
select ceiling(5.5),ceiling(-5.5);
11 12
ceiling(5.5)	ceiling(-5.5)
6	-5
unknown's avatar
unknown committed
13
explain extended select ceiling(5.5),ceiling(-5.5);
14 15
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
16
Warnings:
unknown's avatar
unknown committed
17
Note	1003	select ceiling(5.5) AS `ceiling(5.5)`,ceiling(-(5.5)) AS `ceiling(-5.5)`
18
select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
unknown's avatar
unknown committed
19 20
truncate(52.64,1)	truncate(52.64,2)	truncate(52.64,-1)	truncate(52.64,-2)	truncate(-52.64,1)	truncate(-52.64,-1)
52.6	52.64	50	0	-52.6	-50
unknown's avatar
unknown committed
21
explain extended select truncate(52.64,1),truncate(52.64,2),truncate(52.64,-1),truncate(52.64,-2), truncate(-52.64,1),truncate(-52.64,-1);
22 23
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
24
Warnings:
unknown's avatar
unknown committed
25
Note	1003	select truncate(52.64,1) AS `truncate(52.64,1)`,truncate(52.64,2) AS `truncate(52.64,2)`,truncate(52.64,-(1)) AS `truncate(52.64,-1)`,truncate(52.64,-(2)) AS `truncate(52.64,-2)`,truncate(-(52.64),1) AS `truncate(-52.64,1)`,truncate(-(52.64),-(1)) AS `truncate(-52.64,-1)`
26
select round(5.5),round(-5.5);
27 28
round(5.5)	round(-5.5)
6	-6
unknown's avatar
unknown committed
29
explain extended select round(5.5),round(-5.5);
30 31
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
32
Warnings:
unknown's avatar
unknown committed
33
Note	1003	select round(5.5,0) AS `round(5.5)`,round(-(5.5),0) AS `round(-5.5)`
unknown's avatar
unknown committed
34
select round(5.64,1),round(5.64,2),round(5.64,-1),round(5.64,-2);
35 36
round(5.64,1)	round(5.64,2)	round(5.64,-1)	round(5.64,-2)
5.6	5.64	10	0
unknown's avatar
unknown committed
37
select abs(-10), sign(-5), sign(5), sign(0);
38 39
abs(-10)	sign(-5)	sign(5)	sign(0)
10	-1	1	0
40
explain extended select abs(-10), sign(-5), sign(5), sign(0);
41 42
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
43
Warnings:
unknown's avatar
unknown committed
44
Note	1003	select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
45 46
select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
log(exp(10))	exp(log(sqrt(10))*2)	log(-1)	log(NULL)	log(1,1)	log(3,9)	log(-1,2)	log(NULL,2)
unknown's avatar
unknown committed
47
10	10	NULL	NULL	NULL	2	NULL	NULL
unknown's avatar
unknown committed
48
explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
49 50
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
51
Warnings:
unknown's avatar
unknown committed
52
Note	1003	select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
53 54
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
ln(exp(10))	exp(ln(sqrt(10))*2)	ln(-1)	ln(0)	ln(NULL)
unknown's avatar
unknown committed
55
10	10	NULL	NULL	NULL
unknown's avatar
unknown committed
56
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
57 58
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
59
Warnings:
unknown's avatar
unknown committed
60
Note	1003	select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
61 62
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8)	log2(15)	log2(-2)	log2(0)	log2(NULL)
63
3	3.90689059560852	NULL	NULL	NULL
unknown's avatar
unknown committed
64
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
65 66
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
67
Warnings:
unknown's avatar
unknown committed
68
Note	1003	select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
69 70
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100)	log10(18)	log10(-4)	log10(0)	log10(NULL)
71
2	1.25527250510331	NULL	NULL	NULL
unknown's avatar
unknown committed
72
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
73 74
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
75
Warnings:
unknown's avatar
unknown committed
76
Note	1003	select log10(100) AS `log10(100)`,log10(18) AS `log10(18)`,log10(-(4)) AS `log10(-4)`,log10(0) AS `log10(0)`,log10(NULL) AS `log10(NULL)`
unknown's avatar
unknown committed
77
select pow(10,log10(10)),power(2,4);
78
pow(10,log10(10))	power(2,4)
unknown's avatar
unknown committed
79
10	16
unknown's avatar
unknown committed
80
explain extended select pow(10,log10(10)),power(2,4);
81 82
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
83
Warnings:
unknown's avatar
unknown committed
84
Note	1003	select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4)`
85
set @@rand_seed1=10000000,@@rand_seed2=1000000;
unknown's avatar
unknown committed
86
select rand(999999),rand();
87
rand(999999)	rand()
88
0.0142313651873091	0.028870999839968
unknown's avatar
unknown committed
89
explain extended select rand(999999),rand();
90 91
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
92
Warnings:
93
Note	1003	select rand(999999) AS `rand(999999)`,rand() AS `rand()`
unknown's avatar
unknown committed
94 95 96 97
select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
pi()	format(sin(pi()/2),6)	format(cos(pi()/2),6)	format(abs(tan(pi())),6)	format(cot(1),6)	format(asin(1),6)	format(acos(0),6)	format(atan(1),6)
3.141593	1.000000	0.000000	0.000000	0.642093	1.570796	1.570796	0.785398
explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
98 99
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
100
Warnings:
unknown's avatar
unknown committed
101
Note	1003	select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
unknown's avatar
unknown committed
102
select degrees(pi()),radians(360);
103
degrees(pi())	radians(360)
104
180	6.28318530717959
105 106 107 108 109 110 111 112 113 114 115 116
select format(atan(-2, 2), 6);
format(atan(-2, 2), 6)
-0.785398
select format(atan(pi(), 0), 6);
format(atan(pi(), 0), 6)
1.570796
select format(atan2(-2, 2), 6);
format(atan2(-2, 2), 6)
-0.785398
select format(atan2(pi(), 0), 6);
format(atan2(pi(), 0), 6)
1.570796
117
SELECT ACOS(1.0);
118
ACOS(1.0)
unknown's avatar
unknown committed
119
0
120
SELECT ASIN(1.0);
121
ASIN(1.0)
unknown's avatar
unknown committed
122
1.5707963267949
123
SELECT ACOS(0.2*5.0);
124
ACOS(0.2*5.0)
unknown's avatar
unknown committed
125
0
126
SELECT ACOS(0.5*2.0);
127
ACOS(0.5*2.0)
unknown's avatar
unknown committed
128
0
129
SELECT ASIN(0.8+0.2);
130
ASIN(0.8+0.2)
unknown's avatar
unknown committed
131
1.5707963267949
132
SELECT ASIN(1.2-0.2);
133
ASIN(1.2-0.2)
unknown's avatar
unknown committed
134
1.5707963267949
135 136 137
select format(4.55, 1), format(4.551, 1);
format(4.55, 1)	format(4.551, 1)
4.6	4.6
unknown's avatar
unknown committed
138
explain extended select degrees(pi()),radians(360);
139 140
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
unknown's avatar
unknown committed
141
Warnings:
unknown's avatar
unknown committed
142
Note	1003	select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
143 144
select rand(rand);
ERROR 42S22: Unknown column 'rand' in 'field list'
145 146 147 148 149 150 151 152 153 154 155 156 157
create table t1 (col1 int, col2 decimal(60,30));
insert into t1 values(1,1234567890.12345);
select format(col2,7) from t1;
format(col2,7)
1,234,567,890.1234500
select format(col2,8) from t1;
format(col2,8)
1,234,567,890.12345000
insert into t1 values(7,1234567890123456.12345);
select format(col2,6) from t1 where col1=7;
format(col2,6)
1,234,567,890,123,456.123450
drop table t1;
158 159 160 161 162 163
select ceil(0.09);
ceil(0.09)
1
select ceil(0.000000000000000009);
ceil(0.000000000000000009)
1
164 165 166 167
create table t1 select round(1, 6);
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
168
  `round(1, 6)` int(1) NOT NULL DEFAULT '0'
169 170 171
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1;
round(1, 6)
172
1
173
drop table t1;
174 175 176
select abs(-2) * -2;
abs(-2) * -2
-4
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(1),(1),(2);
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
858	656
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
INSERT INTO t1 VALUES (3);
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
858	656
354	906
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED) 
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(a) * 1000 AS UNSIGNED)
656	405
122	405
645	405
PREPARE stmt FROM 
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
    FROM t1 WHERE a = 1";
set @var=2;
EXECUTE stmt USING @var;
CAST(RAND(2) * 1000 AS UNSIGNED)	CAST(RAND(?) * 1000 AS UNSIGNED)
656	656
122	122
645	645
DROP TABLE t1;
217 218 219 220 221 222
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
a
http://www.foo.com/
drop table t1;
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
set sql_mode='traditional';
select ln(-1);
ln(-1)
NULL
Warnings:
Error	1365	Division by 0
select log10(-1);
log10(-1)
NULL
Warnings:
Error	1365	Division by 0
select log2(-1);
log2(-1)
NULL
Warnings:
Error	1365	Division by 0
select log(2,-1);
log(2,-1)
NULL
Warnings:
Error	1365	Division by 0
select log(-2,1);
log(-2,1)
NULL
Warnings:
Error	1365	Division by 0
set sql_mode='';
unknown's avatar
unknown committed
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
select round(111,-10);
round(111,-10)
0
select round(-5000111000111000155,-1);
round(-5000111000111000155,-1)
-5000111000111000160
select round(15000111000111000155,-1);
round(15000111000111000155,-1)
15000111000111000160
select truncate(-5000111000111000155,-1);
truncate(-5000111000111000155,-1)
-5000111000111000150
select truncate(15000111000111000155,-1);
truncate(15000111000111000155,-1)
15000111000111000150
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
set names utf8;
create table t1
(f1 varchar(32) not null,
f2 smallint(5) unsigned not null,
f3 int(10) unsigned not null default '0')
engine=myisam default charset=utf8;
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
create table t2
(f1 int(10) unsigned not null,
f2 int(10) unsigned not null,
f3 smallint(5) unsigned not null)
engine=myisam default charset=utf8;
insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
select format(t2.f2-t2.f1+1,0) from t1,t2
where t1.f2 = t2.f3 order by t1.f1;
format(t2.f2-t2.f1+1,0)
10,000
10,000
drop table t1, t2;
set names default;
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
select cast(-2 as unsigned), 18446744073709551614, -2;
cast(-2 as unsigned)	18446744073709551614	-2
18446744073709551614	18446744073709551614	-2
select abs(cast(-2 as unsigned)), abs(18446744073709551614), abs(-2);
abs(cast(-2 as unsigned))	abs(18446744073709551614)	abs(-2)
18446744073709551614	18446744073709551614	2
select ceiling(cast(-2 as unsigned)), ceiling(18446744073709551614), ceiling(-2);
ceiling(cast(-2 as unsigned))	ceiling(18446744073709551614)	ceiling(-2)
18446744073709551614	18446744073709551614	-2
select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2);
floor(cast(-2 as unsigned))	floor(18446744073709551614)	floor(-2)
18446744073709551614	18446744073709551614	-2
select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2);
format(cast(-2 as unsigned), 2)	format(18446744073709551614, 2)	format(-2, 2)
18,446,744,073,709,551,614.00	18,446,744,073,709,551,614.00	-2.00
select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2);
sqrt(cast(-2 as unsigned))	sqrt(18446744073709551614)	sqrt(-2)
4294967296	4294967296	NULL
select round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1);
round(cast(-2 as unsigned), 1)	round(18446744073709551614, 1)	round(-2, 1)
18446744073709551614	18446744073709551614	-2
select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2);
round(4, cast(-2 as unsigned))	round(4, 18446744073709551614)	round(4, -2)
4	4	0
select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1);
truncate(cast(-2 as unsigned), 1)	truncate(18446744073709551614, 1)	truncate(-2, 1)
18446744073709551614	18446744073709551614	-2
select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2);
truncate(4, cast(-2 as unsigned))	truncate(4, 18446744073709551614)	truncate(4, -2)
4	4	0
select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
round(10000000000000000000, -19)	truncate(10000000000000000000, -19)
10000000000000000000	10000000000000000000
select round(1e0, -309), truncate(1e0, -309);
round(1e0, -309)	truncate(1e0, -309)
0	0
select round(1e1,308), truncate(1e1, 308);
round(1e1,308)	truncate(1e1, 308)
10	10
select round(1e1, 2147483648), truncate(1e1, 2147483648);
round(1e1, 2147483648)	truncate(1e1, 2147483648)
10	10
select round(1.1e1, 4294967295), truncate(1.1e1, 4294967295);
round(1.1e1, 4294967295)	truncate(1.1e1, 4294967295)
11	11
select round(1.12e1, 4294967296), truncate(1.12e1, 4294967296);
round(1.12e1, 4294967296)	truncate(1.12e1, 4294967296)
11.2	11.2
select round(1.5, 2147483640), truncate(1.5, 2147483640);
round(1.5, 2147483640)	truncate(1.5, 2147483640)
1.500000000000000000000000000000	1.500000000000000000000000000000
select round(1.5, -2147483649), round(1.5, 2147483648);
round(1.5, -2147483649)	round(1.5, 2147483648)
0	1.500000000000000000000000000000
select truncate(1.5, -2147483649), truncate(1.5, 2147483648);
truncate(1.5, -2147483649)	truncate(1.5, 2147483648)
0	1.500000000000000000000000000000
select round(1.5, -4294967296), round(1.5, 4294967296);
round(1.5, -4294967296)	round(1.5, 4294967296)
0	1.500000000000000000000000000000
select truncate(1.5, -4294967296), truncate(1.5, 4294967296);
truncate(1.5, -4294967296)	truncate(1.5, 4294967296)
0	1.500000000000000000000000000000
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
round(1.5, -9223372036854775808)	round(1.5, 9223372036854775808)
0	1.500000000000000000000000000000
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
truncate(1.5, -9223372036854775808)	truncate(1.5, 9223372036854775808)
0	1.500000000000000000000000000000
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
round(1.5, 18446744073709551615)	truncate(1.5, 18446744073709551615)
1.500000000000000000000000000000	1.500000000000000000000000000000
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
round(18446744073709551614, -1)	truncate(18446744073709551614, -1)
18446744073709551610	18446744073709551610
select round(4, -4294967200), truncate(4, -4294967200);
round(4, -4294967200)	truncate(4, -4294967200)
0	0
select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
mod(cast(-2 as unsigned), 3)	mod(18446744073709551614, 3)	mod(-2, 3)
2	2	-2
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
mod(5, cast(-2 as unsigned))	mod(5, 18446744073709551614)	mod(5, -2)
5	5	1
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
pow(cast(-2 as unsigned), 5)	pow(18446744073709551614, 5)	pow(-2, 5)
371
2.13598703592091e+96	2.13598703592091e+96	-32
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
SELECT a DIV 900 y FROM t1 GROUP BY y;
y
22201025555
22255916666
SELECT DISTINCT a DIV 900 y FROM t1;
y
22201025555
22255916666
SELECT b DIV 900 y FROM t1 GROUP BY y;
y
0
SELECT c DIV 900 y FROM t1 GROUP BY y;
y
0
DROP TABLE t1;
CREATE TABLE t1(a LONGBLOB);
INSERT INTO t1 VALUES('1'),('2'),('3');
SELECT DISTINCT (a DIV 254576881) FROM t1;
(a DIV 254576881)
0
SELECT (a DIV 254576881) FROM t1 UNION ALL 
SELECT (a DIV 254576881) FROM t1;
(a DIV 254576881)
0
0
0
0
0
0
DROP TABLE t1;
CREATE TABLE t1(a SET('a','b','c'));
INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
a DIV 2
0
DROP TABLE t1;
410
End of 5.0 tests
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
SELECT 1e308 + 1e308;
1e308 + 1e308
NULL
SELECT -1e308 - 1e308;
-1e308 - 1e308
NULL
SELECT 1e300 * 1e300;
1e300 * 1e300
NULL
SELECT 1e300 / 1e-300;
1e300 / 1e-300
NULL
SELECT EXP(750);
EXP(750)
NULL
SELECT POW(10, 309);
POW(10, 309)
NULL
End of 5.1 tests