45
45
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);
46
46
log(exp(10)) exp(log(sqrt(10))*2) log(-1) log(NULL) log(1,1) log(3,9) log(-1,2) log(NULL,2)
47
47
10 10.000000000000002 NULL NULL NULL 2 NULL NULL
49
Error 1365 Division by 0
50
Error 1365 Division by 0
51
Error 1365 Division by 0
48
52
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
53
id select_type table type possible_keys key key_len ref rows filtered Extra
50
54
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
53
57
select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
54
58
ln(exp(10)) exp(ln(sqrt(10))*2) ln(-1) ln(0) ln(NULL)
55
59
10 10.000000000000002 NULL NULL NULL
61
Error 1365 Division by 0
62
Error 1365 Division by 0
56
63
explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
57
64
id select_type table type possible_keys key key_len ref rows filtered Extra
58
65
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
61
68
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
62
69
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
63
70
3 3.9068905956085187 NULL NULL NULL
72
Error 1365 Division by 0
73
Error 1365 Division by 0
64
74
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
65
75
id select_type table type possible_keys key key_len ref rows filtered Extra
66
76
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
69
79
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
70
80
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
71
81
2 1.255272505103306 NULL NULL NULL
83
Error 1365 Division by 0
84
Error 1365 Division by 0
72
85
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
73
86
id select_type table type possible_keys key key_len ref rows filtered Extra
74
87
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
93
106
Note 1003 select rand(999999) AS `rand(999999)`,rand() AS `rand()`
94
107
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);
95
108
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)
96
3.141593 1.000000 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398
109
3.141593 NULL 0.000000 0.000000 0.642093 1.570796 1.570796 0.785398
111
Warning 1292 Incorrect datetime value: '2'
97
112
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
113
id select_type table type possible_keys key key_len ref rows filtered Extra
99
114
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
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)`
116
Note 1003 select pi() AS `pi()`,format(month((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)`
102
117
select degrees(pi()),radians(360);
103
118
degrees(pi()) radians(360)
104
119
180 6.283185307179586
208
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
209
FROM t1 WHERE a = 1";
211
EXECUTE stmt USING @var;
212
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(?) * 1000 AS UNSIGNED)
217
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
223
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb;
218
224
insert into t1 values ('http://www.foo.com/', now());
219
225
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
221
227
http://www.foo.com/
223
set sql_mode='traditional';
228
Error 1365 Division by 0
233
Error 1365 Division by 0
238
Error 1365 Division by 0
243
Error 1365 Division by 0
248
Error 1365 Division by 0
250
229
select round(111,-10);
262
241
select truncate(15000111000111000155,-1);
263
242
truncate(15000111000111000155,-1)
264
243
15000111000111000150
267
245
(f1 varchar(32) not null,
268
f2 smallint(5) unsigned not null,
269
f3 int(10) unsigned not null default '0')
270
engine=myisam default charset=utf8;
246
f2 smallint unsigned not null,
247
f3 int unsigned not null default '0')
271
249
insert into t1 values ('zombie',0,0),('gold',1,10000),('silver',2,10000);
273
(f1 int(10) unsigned not null,
274
f2 int(10) unsigned not null,
275
f3 smallint(5) unsigned not null)
276
engine=myisam default charset=utf8;
251
(f1 int unsigned not null,
252
f2 int unsigned not null,
253
f3 smallint unsigned not null)
277
255
insert into t2 values (16777216,16787215,1),(33554432,33564431,2);
278
256
select format(t2.f2-t2.f1+1,0) from t1,t2
279
257
where t1.f2 = t2.f3 order by t1.f1;
347
324
0 1.500000000000000000000000000000
348
325
select round(1.5, -9223372036854775808), round(1.5, 9223372036854775808);
349
326
round(1.5, -9223372036854775808) round(1.5, 9223372036854775808)
350
0 1.500000000000000000000000000000
327
0 2.000000000000000000000000000000
351
328
select truncate(1.5, -9223372036854775808), truncate(1.5, 9223372036854775808);
352
329
truncate(1.5, -9223372036854775808) truncate(1.5, 9223372036854775808)
353
0 1.500000000000000000000000000000
330
0 1.000000000000000000000000000000
354
331
select round(1.5, 18446744073709551615), truncate(1.5, 18446744073709551615);
355
332
round(1.5, 18446744073709551615) truncate(1.5, 18446744073709551615)
356
1.500000000000000000000000000000 1.500000000000000000000000000000
333
0.000000000000000000000000000000 0.000000000000000000000000000000
357
334
select round(18446744073709551614, -1), truncate(18446744073709551614, -1);
358
335
round(18446744073709551614, -1) truncate(18446744073709551614, -1)
359
336
18446744073709551610 18446744073709551610
369
346
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
370
347
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
371
348
2.13598703592091e96 2.13598703592091e96 -32
372
CREATE TABLE t1 (a timestamp, b varchar(20), c bit(1));
349
CREATE TABLE t1 (a timestamp, b varchar(20), c bit);
373
350
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
374
351
SELECT a DIV 900 y FROM t1 GROUP BY y;