190
190
CREATE TABLE t1 (a INT);
191
191
INSERT INTO t1 VALUES (1),(1),(1),(2);
192
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
194
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
199
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
201
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
192
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1;
193
RAND(2) * 1000 RAND(a) * 1000
194
655.5866465490186 405.40353712197725
195
122.34661925802624 405.40353712197725
196
644.97318737672 405.40353712197725
197
857.8261098431667 655.5866465490186
198
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1 WHERE a = 1;
199
RAND(2) * 1000 RAND(a) * 1000
200
655.5866465490186 405.40353712197725
201
122.34661925802624 405.40353712197725
202
644.97318737672 405.40353712197725
205
203
INSERT INTO t1 VALUES (3);
206
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
208
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
214
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
216
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
204
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1;
205
RAND(2) * 1000 RAND(a) * 1000
206
655.5866465490186 405.40353712197725
207
122.34661925802624 405.40353712197725
208
644.97318737672 405.40353712197725
209
857.8261098431667 655.5866465490186
210
354.21101781931804 905.7697559760601
211
SELECT RAND(2) * 1000, RAND(a) * 1000 FROM t1 WHERE a = 1;
212
RAND(2) * 1000 RAND(a) * 1000
213
655.5866465490186 405.40353712197725
214
122.34661925802624 405.40353712197725
215
644.97318737672 405.40353712197725
221
217
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb;
222
218
insert into t1 values ('http://www.foo.com/', now());
259
255
drop table t1, t2;
260
select cast(-2 as unsigned), 18446744073709551614, -2;
261
cast(-2 as unsigned) 18446744073709551614 -2
262
18446744073709551614 18446744073709551614 -2
263
select abs(cast(-2 as unsigned)), abs(18446744073709551614), abs(-2);
264
abs(cast(-2 as unsigned)) abs(18446744073709551614) abs(-2)
265
18446744073709551614 18446744073709551614 2
266
select ceiling(cast(-2 as unsigned)), ceiling(18446744073709551614), ceiling(-2);
267
ceiling(cast(-2 as unsigned)) ceiling(18446744073709551614) ceiling(-2)
268
18446744073709551614 18446744073709551614 -2
269
select floor(cast(-2 as unsigned)), floor(18446744073709551614), floor(-2);
270
floor(cast(-2 as unsigned)) floor(18446744073709551614) floor(-2)
271
18446744073709551614 18446744073709551614 -2
272
select format(cast(-2 as unsigned), 2), format(18446744073709551614, 2), format(-2, 2);
273
format(cast(-2 as unsigned), 2) format(18446744073709551614, 2) format(-2, 2)
274
18,446,744,073,709,551,614.00 18,446,744,073,709,551,614.00 -2.00
275
select sqrt(cast(-2 as unsigned)), sqrt(18446744073709551614), sqrt(-2);
276
sqrt(cast(-2 as unsigned)) sqrt(18446744073709551614) sqrt(-2)
277
4294967296 4294967296 NULL
278
select round(cast(-2 as unsigned), 1), round(18446744073709551614, 1), round(-2, 1);
279
round(cast(-2 as unsigned), 1) round(18446744073709551614, 1) round(-2, 1)
280
18446744073709551614 18446744073709551614 -2
281
select round(4, cast(-2 as unsigned)), round(4, 18446744073709551614), round(4, -2);
282
round(4, cast(-2 as unsigned)) round(4, 18446744073709551614) round(4, -2)
284
select truncate(cast(-2 as unsigned), 1), truncate(18446744073709551614, 1), truncate(-2, 1);
285
truncate(cast(-2 as unsigned), 1) truncate(18446744073709551614, 1) truncate(-2, 1)
286
18446744073709551614 18446744073709551614 -2
287
select truncate(4, cast(-2 as unsigned)), truncate(4, 18446744073709551614), truncate(4, -2);
288
truncate(4, cast(-2 as unsigned)) truncate(4, 18446744073709551614) truncate(4, -2)
256
select -2, 18446744073709551614, -2;
257
-2 18446744073709551614 -2
258
-2 18446744073709551614 -2
259
select abs(-2), abs(18446744073709551614), abs(-2);
260
abs(-2) abs(18446744073709551614) abs(-2)
261
2 18446744073709551614 2
262
select ceiling(-2), ceiling(18446744073709551614), ceiling(-2);
263
ceiling(-2) ceiling(18446744073709551614) ceiling(-2)
264
-2 18446744073709551614 -2
265
select floor(-2), floor(18446744073709551614), floor(-2);
266
floor(-2) floor(18446744073709551614) floor(-2)
267
-2 18446744073709551614 -2
268
select format(-2, 2), format(18446744073709551614, 2), format(-2, 2);
269
format(-2, 2) format(18446744073709551614, 2) format(-2, 2)
270
-2.00 18,446,744,073,709,551,614.00 -2.00
271
select sqrt(-2), sqrt(18446744073709551614), sqrt(-2);
272
sqrt(-2) sqrt(18446744073709551614) sqrt(-2)
274
select round(-2, 1), round(18446744073709551614, 1), round(-2, 1);
275
round(-2, 1) round(18446744073709551614, 1) round(-2, 1)
276
-2 18446744073709551614 -2
277
select round(4, -2), round(4, 18446744073709551614), round(4, -2);
278
round(4, -2) round(4, 18446744073709551614) round(4, -2)
280
select truncate(-2, 1), truncate(18446744073709551614, 1), truncate(-2, 1);
281
truncate(-2, 1) truncate(18446744073709551614, 1) truncate(-2, 1)
282
-2 18446744073709551614 -2
283
select truncate(4, -2), truncate(4, 18446744073709551614), truncate(4, -2);
284
truncate(4, -2) truncate(4, 18446744073709551614) truncate(4, -2)
290
286
select round(10000000000000000000, -19), truncate(10000000000000000000, -19);
291
287
round(10000000000000000000, -19) truncate(10000000000000000000, -19)
292
288
10000000000000000000 10000000000000000000
335
331
select round(4, -4294967200), truncate(4, -4294967200);
336
332
round(4, -4294967200) truncate(4, -4294967200)
338
select mod(cast(-2 as unsigned), 3), mod(18446744073709551614, 3), mod(-2, 3);
339
mod(cast(-2 as unsigned), 3) mod(18446744073709551614, 3) mod(-2, 3)
341
select mod(5, cast(-2 as unsigned)), mod(5, 18446744073709551614), mod(5, -2);
342
mod(5, cast(-2 as unsigned)) mod(5, 18446744073709551614) mod(5, -2)
344
select pow(cast(-2 as unsigned), 5), pow(18446744073709551614, 5), pow(-2, 5);
345
pow(cast(-2 as unsigned), 5) pow(18446744073709551614, 5) pow(-2, 5)
346
2.13598703592091e96 2.13598703592091e96 -32
334
select mod(-2, 3), mod(18446744073709551614, 3), mod(-2, 3);
335
mod(-2, 3) mod(18446744073709551614, 3) mod(-2, 3)
337
select mod(5, -2), mod(5, 18446744073709551614), mod(5, -2);
338
mod(5, -2) mod(5, 18446744073709551614) mod(5, -2)
340
select pow(-2, 5), pow(18446744073709551614, 5), pow(-2, 5);
341
pow(-2, 5) pow(18446744073709551614, 5) pow(-2, 5)
342
-32 2.13598703592091e96 -32
347
343
CREATE TABLE t1 (a timestamp, b varchar(20), c int);
348
344
INSERT INTO t1 VALUES('1998-09-23', 'str1', 1), ('2003-03-25', 'str2', 0);
349
345
SELECT a DIV 900 y FROM t1 GROUP BY y;