1
drop table if exists t1,t2;
2
select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo';
3
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
4
hello 'hello' ""hello"" 'h'e'l'l'o' hel"lo hel'lo
5
select 'hello' 'monty';
8
select length('\n\t\r\b\0\_\%\\');
9
length('\n\t\r\b\0\_\%\\')
11
select bit_length('\n\t\r\b\0\_\%\\');
12
bit_length('\n\t\r\b\0\_\%\\')
14
select char_length('\n\t\r\b\0\_\%\\');
15
char_length('\n\t\r\b\0\_\%\\')
17
select length('\n\t\n\b\0\\_\\%\\');
18
length('\n\t\n\b\0\\_\\%\\')
20
select concat('monty',' was here ','again'),length('hello'),char(ascii('h')),ord('h');
21
concat('monty',' was here ','again') length('hello') char(ascii('h')) ord('h')
22
monty was here again 5 h 104
23
select hex(char(256));
26
select locate('he','hello'),locate('he','hello',2),locate('lo','hello',2) ;
27
locate('he','hello') locate('he','hello',2) locate('lo','hello',2)
29
select instr('hello','HE'), instr('hello',binary 'HE'), instr(binary 'hello','HE');
30
instr('hello','HE') instr('hello',binary 'HE') instr(binary 'hello','HE')
32
select position(binary 'll' in 'hello'),position('a' in binary 'hello');
33
position(binary 'll' in 'hello') position('a' in binary 'hello')
35
select left('hello',null), right('hello',null);
36
left('hello',null) right('hello',null)
38
select left('hello',2),right('hello',2),substring('hello',2,2),mid('hello',1,5) ;
39
left('hello',2) right('hello',2) substring('hello',2,2) mid('hello',1,5)
41
select concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1)) ;
42
concat('',left(right(concat('what ',concat('is ','happening')),9),4),'',substring('monty',5,1))
44
select substring_index('www.tcx.se','.',-2),substring_index('www.tcx.se','.',1);
45
substring_index('www.tcx.se','.',-2) substring_index('www.tcx.se','.',1)
47
select substring_index('www.tcx.se','tcx',1),substring_index('www.tcx.se','tcx',-1);
48
substring_index('www.tcx.se','tcx',1) substring_index('www.tcx.se','tcx',-1)
50
select substring_index('.tcx.se','.',-2),substring_index('.tcx.se','.tcx',-1);
51
substring_index('.tcx.se','.',-2) substring_index('.tcx.se','.tcx',-1)
53
select substring_index('aaaaaaaaa1','a',1);
54
substring_index('aaaaaaaaa1','a',1)
56
select substring_index('aaaaaaaaa1','aa',1);
57
substring_index('aaaaaaaaa1','aa',1)
59
select substring_index('aaaaaaaaa1','aa',2);
60
substring_index('aaaaaaaaa1','aa',2)
62
select substring_index('aaaaaaaaa1','aa',3);
63
substring_index('aaaaaaaaa1','aa',3)
65
select substring_index('aaaaaaaaa1','aa',4);
66
substring_index('aaaaaaaaa1','aa',4)
68
select substring_index('aaaaaaaaa1','aa',5);
69
substring_index('aaaaaaaaa1','aa',5)
71
select substring_index('aaaaaaaaa1','aaa',1);
72
substring_index('aaaaaaaaa1','aaa',1)
74
select substring_index('aaaaaaaaa1','aaa',2);
75
substring_index('aaaaaaaaa1','aaa',2)
77
select substring_index('aaaaaaaaa1','aaa',3);
78
substring_index('aaaaaaaaa1','aaa',3)
80
select substring_index('aaaaaaaaa1','aaa',4);
81
substring_index('aaaaaaaaa1','aaa',4)
83
select substring_index('aaaaaaaaa1','aaaa',1);
84
substring_index('aaaaaaaaa1','aaaa',1)
86
select substring_index('aaaaaaaaa1','aaaa',2);
87
substring_index('aaaaaaaaa1','aaaa',2)
89
select substring_index('aaaaaaaaa1','1',1);
90
substring_index('aaaaaaaaa1','1',1)
92
select substring_index('aaaaaaaaa1','a',-1);
93
substring_index('aaaaaaaaa1','a',-1)
95
select substring_index('aaaaaaaaa1','aa',-1);
96
substring_index('aaaaaaaaa1','aa',-1)
98
select substring_index('aaaaaaaaa1','aa',-2);
99
substring_index('aaaaaaaaa1','aa',-2)
101
select substring_index('aaaaaaaaa1','aa',-3);
102
substring_index('aaaaaaaaa1','aa',-3)
104
select substring_index('aaaaaaaaa1','aa',-4);
105
substring_index('aaaaaaaaa1','aa',-4)
107
select substring_index('aaaaaaaaa1','aa',-5);
108
substring_index('aaaaaaaaa1','aa',-5)
110
select substring_index('aaaaaaaaa1','aaa',-1);
111
substring_index('aaaaaaaaa1','aaa',-1)
113
select substring_index('aaaaaaaaa1','aaa',-2);
114
substring_index('aaaaaaaaa1','aaa',-2)
116
select substring_index('aaaaaaaaa1','aaa',-3);
117
substring_index('aaaaaaaaa1','aaa',-3)
119
select substring_index('aaaaaaaaa1','aaa',-4);
120
substring_index('aaaaaaaaa1','aaa',-4)
122
select substring_index('the king of thethe hill','the',-2);
123
substring_index('the king of thethe hill','the',-2)
125
select substring_index('the king of the the hill','the',-2);
126
substring_index('the king of the the hill','the',-2)
128
select substring_index('the king of the the hill','the',-2);
129
substring_index('the king of the the hill','the',-2)
131
select substring_index('the king of the the hill',' the ',-1);
132
substring_index('the king of the the hill',' the ',-1)
134
select substring_index('the king of the the hill',' the ',-2);
135
substring_index('the king of the the hill',' the ',-2)
137
select substring_index('the king of the the hill',' ',-1);
138
substring_index('the king of the the hill',' ',-1)
140
select substring_index('the king of the the hill',' ',-2);
141
substring_index('the king of the the hill',' ',-2)
143
select substring_index('the king of the the hill',' ',-3);
144
substring_index('the king of the the hill',' ',-3)
146
select substring_index('the king of the the hill',' ',-4);
147
substring_index('the king of the the hill',' ',-4)
149
select substring_index('the king of the the hill',' ',-5);
150
substring_index('the king of the the hill',' ',-5)
152
select substring_index('the king of the.the hill','the',-2);
153
substring_index('the king of the.the hill','the',-2)
155
select substring_index('the king of thethethe.the hill','the',-3);
156
substring_index('the king of thethethe.the hill','the',-3)
158
select substring_index('the king of thethethe.the hill','the',-1);
159
substring_index('the king of thethethe.the hill','the',-1)
161
select substring_index('the king of the the hill','the',1);
162
substring_index('the king of the the hill','the',1)
164
select substring_index('the king of the the hill','the',2);
165
substring_index('the king of the the hill','the',2)
167
select substring_index('the king of the the hill','the',3);
168
substring_index('the king of the the hill','the',3)
170
select concat(':',ltrim(' left '),':',rtrim(' right '),':');
171
concat(':',ltrim(' left '),':',rtrim(' right '),':')
173
select concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':');
174
concat(':',trim(leading from ' left '),':',trim(trailing from ' right '),':')
176
select concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':');
177
concat(':',trim(LEADING FROM ' left'),':',trim(TRAILING FROM ' right '),':')
179
select concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':');
180
concat(':',trim(' m '),':',trim(BOTH FROM ' y '),':',trim('*' FROM '*s*'),':')
182
select concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':');
183
concat(':',trim(BOTH 'ab' FROM 'ababmyabab'),':',trim(BOTH '*' FROM '***sql'),':')
185
select concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':');
186
concat(':',trim(LEADING '.*' FROM '.*my'),':',trim(TRAILING '.*' FROM 'sql.*.*'),':')
188
select TRIM("foo" FROM "foo"), TRIM("foo" FROM "foook"), TRIM("foo" FROM "okfoo");
189
TRIM("foo" FROM "foo") TRIM("foo" FROM "foook") TRIM("foo" FROM "okfoo")
191
select concat_ws(', ','monty','was here','again');
192
concat_ws(', ','monty','was here','again')
193
monty, was here, again
194
select concat_ws(NULL,'a'),concat_ws(',',NULL,'');
195
concat_ws(NULL,'a') concat_ws(',',NULL,'')
197
select concat_ws(',','',NULL,'a');
198
concat_ws(',','',NULL,'a')
200
SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"');
201
CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),repeat('d',100)), '"')
202
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc";"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
203
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
204
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
206
select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c');
207
replace('aaaa','a','b') replace('aaaa','aa','b') replace('aaaa','a','bb') replace('aaaa','','b') replace('bbbb','a','c')
208
bbbb bb bbbbbbbb aaaa bbbb
209
select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') ;
210
replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL')
215
select repeat('monty',5),concat('*',space(5),'*');
216
repeat('monty',5) concat('*',space(5),'*')
217
montymontymontymontymonty * *
218
select reverse('abc'),reverse('abcd');
219
reverse('abc') reverse('abcd')
221
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
222
rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') rpad(11, 10 , 22) rpad("ab", 10, 22)
223
a111 a121 abc 1122222222 ab22222222
224
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
225
lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') lpad(11, 10 , 22)
226
111a 121a abc 2222222211
227
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
228
rpad(741653838,17,'0') lpad(741653838,17,'0')
229
74165383800000000 00000000741653838
230
select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
231
rpad('abcd',7,'ab') lpad('abcd',7,'ab')
233
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
234
rpad('abcd',1,'ab') lpad('abcd',1,'ab')
236
select rpad('STRING', 20, CONCAT('p','a','d') );
237
rpad('STRING', 20, CONCAT('p','a','d') )
239
select lpad('STRING', 20, CONCAT('p','a','d') );
240
lpad('STRING', 20, CONCAT('p','a','d') )
242
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
243
LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD')
245
select quote('\'\"\\test');
248
select quote(concat('abc\'', '\\cba'));
249
quote(concat('abc\'', '\\cba'))
251
select quote(1/0), quote('\0\Z');
252
quote(1/0) quote('\0\Z')
255
Error 1365 Division by 0
256
select length(quote(concat(char(0),"test")));
257
length(quote(concat(char(0),"test")))
259
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
260
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
262
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
263
unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") unhex(NULL)
264
foobar 1234567890ABCDEF 4Vx NULL
265
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
266
hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456"))
267
01 12 0123 1234 012345 123456
268
select concat('a', quote(NULL));
269
concat('a', quote(NULL))
274
select insert("aa",100,1,"b"),insert("aa",1,3,"b"),left("aa",-1),substring("a",1,2);
275
insert("aa",100,1,"b") insert("aa",1,3,"b") left("aa",-1) substring("a",1,2)
277
select elt(2,1),field(NULL,"a","b","c"),reverse("");
278
elt(2,1) field(NULL,"a","b","c") reverse("")
280
select locate("a","b",2),locate("","a",1);
281
locate("a","b",2) locate("","a",1)
283
select ltrim("a"),rtrim("a"),trim(BOTH "" from "a"),trim(BOTH " " from "a");
284
ltrim("a") rtrim("a") trim(BOTH "" from "a") trim(BOTH " " from "a")
286
select substring_index("www.tcx.se","",3);
287
substring_index("www.tcx.se","",3)
289
select length(repeat("a",100000000)),length(repeat("a",1000*64));
290
length(repeat("a",100000000)) length(repeat("a",1000*64))
293
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
294
select position("0" in "baaa" in (1)),position("0" in "1" in (1,2,3)),position("sql" in ("mysql"));
295
position("0" in "baaa" in (1)) position("0" in "1" in (1,2,3)) position("sql" in ("mysql"))
298
Warning 1292 Truncated incorrect DOUBLE value: 'baaa'
299
select position(("1" in (1,2,3)) in "01");
300
position(("1" in (1,2,3)) in "01")
302
select length(repeat("a",65500)),length(concat(repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",10000)))),length(insert(repeat("a",40000),1,30000,repeat("b",50000)));
303
length(repeat("a",65500)) length(concat(repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",10000)))) length(insert(repeat("a",40000),1,30000,repeat("b",50000)))
304
65500 64000 50000 60000
305
select length(repeat("a",1000000)),length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))),length(replace("aaaaa","a",concat(repeat("a",32000)))),length(insert(repeat("a",48000),1,1000,repeat("a",48000)));
306
length(repeat("a",1000000)) length(concat(repeat("a",32000),repeat("a",32000),repeat("a",32000))) length(replace("aaaaa","a",concat(repeat("a",32000)))) length(insert(repeat("a",48000),1,1000,repeat("a",48000)))
307
1000000 96000 160000 95000
308
create table t1 ( domain char(50) );
309
insert into t1 VALUES ("hello.de" ), ("test.de" );
310
select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@hello.de';
313
select domain from t1 where concat('@', trim(leading '.' from concat('.', domain))) = '@test.de';
319
title varchar(255) default NULL,
320
prio int default NULL,
321
category int default NULL,
322
program int default NULL,
324
created datetime default NULL,
325
modified timestamp NOT NULL,
326
bugstatus int default NULL,
327
submitter int default NULL
329
INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','2001-02-28 08:40:16',20010228084016,0,4);
330
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"') FROM t1;
331
CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter), '"')
332
"Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4"
333
SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1;
334
CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"')
335
"Link";"1";"1";"1";"0";"4"
336
SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter) FROM t1;
337
CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified+0,bugstatus,submitter)
338
Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4
339
SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc;
340
bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb')
341
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
343
CREATE TABLE t1 (id int NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) ENGINE=MyISAM;
344
INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf');
347
wid int NOT NULL auto_increment,
348
data_podp date default NULL,
349
status_wnio enum('nowy','podp','real','arch') NOT NULL default 'nowy',
352
INSERT INTO t1 VALUES (8,NULL,'real');
353
INSERT INTO t1 VALUES (9,NULL,'nowy');
354
SELECT elt(status_wnio,data_podp) FROM t1 GROUP BY wid;
355
elt(status_wnio,data_podp)
359
CREATE TABLE t1 (title text) ENGINE=MyISAM;
360
INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education');
361
INSERT INTO t1 VALUES ('House passes the CAREERS bill');
362
SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1;
363
CONCAT("</a>",RPAD("",(55 - LENGTH(title)),"."))
365
</a>..........................
367
CREATE TABLE t1 (i int, j int);
368
INSERT INTO t1 VALUES (1,1),(2,2);
369
SELECT DISTINCT i, ELT(j, '345', '34') FROM t1;
370
i ELT(j, '345', '34')
374
create table t1(a char(4));
375
insert into t1 values ('one'),(NULL),('two'),('four');
376
select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
377
a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
381
four 'four' 0 0 'four'
383
select trim(trailing 'foo' from 'foo');
384
trim(trailing 'foo' from 'foo')
386
select trim(leading 'foo' from 'foo');
387
trim(leading 'foo' from 'foo')
389
select quote(ltrim(concat(' ', 'a')));
390
quote(ltrim(concat(' ', 'a')))
392
select quote(trim(concat(' ', 'a')));
393
quote(trim(concat(' ', 'a')))
395
CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
396
SELECT QUOTE('A') FROM t1;
402
select SUBSTR('abcdefg',3,2);
403
SUBSTR('abcdefg',3,2)
405
select SUBSTRING('abcdefg',3,2);
406
SUBSTRING('abcdefg',3,2)
408
select SUBSTR('abcdefg',-3,2);
409
SUBSTR('abcdefg',-3,2)
411
select SUBSTR('abcdefg',-1,5);
412
SUBSTR('abcdefg',-1,5)
414
select SUBSTR('abcdefg',0,0);
415
SUBSTR('abcdefg',0,0)
417
select SUBSTR('abcdefg',-1,-1);
418
SUBSTR('abcdefg',-1,-1)
420
select SUBSTR('abcdefg',1,-1);
421
SUBSTR('abcdefg',1,-1)
423
select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2),substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2);
424
substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2) substring_index("1abcd;2abcd;3abcd;4abcd", ';', -2)
425
1abcd;2abcd 3abcd;4abcd
426
explain extended select concat('*',space(5),'*');
427
id select_type table type possible_keys key key_len ref rows filtered Extra
428
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
430
Note 1003 select concat('*',repeat(' ',5),'*') AS `concat('*',space(5),'*')`
431
explain extended select reverse('abc');
432
id select_type table type possible_keys key key_len ref rows filtered Extra
433
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
435
Note 1003 select reverse('abc') AS `reverse('abc')`
436
explain extended select rpad('a',4,'1');
437
id select_type table type possible_keys key key_len ref rows filtered Extra
438
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
440
Note 1003 select rpad('a',4,'1') AS `rpad('a',4,'1')`
441
explain extended select lpad('a',4,'1');
442
id select_type table type possible_keys key key_len ref rows filtered Extra
443
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
445
Note 1003 select lpad('a',4,'1') AS `lpad('a',4,'1')`
446
explain extended select concat_ws(',','',NULL,'a');
447
id select_type table type possible_keys key key_len ref rows filtered Extra
448
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
450
Note 1003 select concat_ws(',','',NULL,'a') AS `concat_ws(',','',NULL,'a')`
451
explain extended select elt(2,1);
452
id select_type table type possible_keys key key_len ref rows filtered Extra
453
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
455
Note 1003 select elt(2,1) AS `elt(2,1)`
456
explain extended select locate("a","b",2);
457
id select_type table type possible_keys key key_len ref rows filtered Extra
458
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
460
Note 1003 select locate('a','b',2) AS `locate("a","b",2)`
461
explain extended select char(0);
462
id select_type table type possible_keys key key_len ref rows filtered Extra
463
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
465
Note 1003 select char(0) AS `char(0)`
466
explain extended select conv(130,16,10);
467
id select_type table type possible_keys key key_len ref rows filtered Extra
468
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
470
Note 1003 select conv(130,16,10) AS `conv(130,16,10)`
471
explain extended select hex(130);
472
id select_type table type possible_keys key key_len ref rows filtered Extra
473
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
475
Note 1003 select hex(130) AS `hex(130)`
476
explain extended select binary 'HE';
477
id select_type table type possible_keys key key_len ref rows filtered Extra
478
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
480
Note 1003 select cast('HE' as char charset binary) AS `binary 'HE'`
481
explain extended select collation(conv(130,16,10));
482
id select_type table type possible_keys key key_len ref rows filtered Extra
483
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
485
Note 1003 select collation(conv(130,16,10)) AS `collation(conv(130,16,10))`
486
explain extended select coercibility(conv(130,16,10));
487
id select_type table type possible_keys key key_len ref rows filtered Extra
488
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
490
Note 1003 select coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`
491
explain extended select length('\n\t\r\b\0\_\%\\');
492
id select_type table type possible_keys key key_len ref rows filtered Extra
493
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
495
Note 1003 select length('\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`
496
explain extended select concat('monty',' was here ','again');
497
id select_type table type possible_keys key key_len ref rows filtered Extra
498
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
500
Note 1003 select concat('monty',' was here ','again') AS `concat('monty',' was here ','again')`
501
explain extended select length('hello');
502
id select_type table type possible_keys key key_len ref rows filtered Extra
503
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
505
Note 1003 select length('hello') AS `length('hello')`
506
explain extended select char(ascii('h'));
507
id select_type table type possible_keys key key_len ref rows filtered Extra
508
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
510
Note 1003 select char(ascii('h')) AS `char(ascii('h'))`
511
explain extended select ord('h');
512
id select_type table type possible_keys key key_len ref rows filtered Extra
513
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
515
Note 1003 select ord('h') AS `ord('h')`
516
explain extended select quote(1/0);
517
id select_type table type possible_keys key key_len ref rows filtered Extra
518
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
520
Note 1003 select quote((1 / 0)) AS `quote(1/0)`
521
explain extended select crc32("123");
522
id select_type table type possible_keys key key_len ref rows filtered Extra
523
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
525
Note 1003 select crc32('123') AS `crc32("123")`
526
explain extended select replace('aaaa','a','b');
527
id select_type table type possible_keys key key_len ref rows filtered Extra
528
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
530
Note 1003 select replace('aaaa','a','b') AS `replace('aaaa','a','b')`
531
explain extended select insert('txs',2,1,'hi');
532
id select_type table type possible_keys key key_len ref rows filtered Extra
533
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
535
Note 1003 select insert('txs',2,1,'hi') AS `insert('txs',2,1,'hi')`
536
explain extended select SUBSTR('abcdefg',3,2);
537
id select_type table type possible_keys key key_len ref rows filtered Extra
538
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
540
Note 1003 select substr('abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`
541
explain extended select substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2);
542
id select_type table type possible_keys key key_len ref rows filtered Extra
543
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
545
Note 1003 select substring_index('1abcd;2abcd;3abcd;4abcd',';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`
546
SELECT lpad(12345, 5, "#");
549
SELECT conv(71, 10, 36), conv('1Z', 36, 10);
550
conv(71, 10, 36) conv('1Z', 36, 10)
552
SELECT conv(71, 10, 37), conv('1Z', 37, 10), conv(0,1,10),conv(0,0,10), conv(0,-1,10);
553
conv(71, 10, 37) conv('1Z', 37, 10) conv(0,1,10) conv(0,0,10) conv(0,-1,10)
554
NULL NULL NULL NULL NULL
555
create table t1 (id int, str varchar(10));
556
insert into t1 values (1,'aaaaaaaaaa'), (2,'bbbbbbbbbb');
557
create table t2 (id int, str varchar(10));
558
insert into t2 values (1,'cccccccccc'), (2,'dddddddddd');
559
select substring(concat(t1.str, t2.str), 1, 15) "name" from t1, t2
560
where t2.id=t1.id order by name;
565
create table t1 (c1 INT, c2 INT);
566
insert into t1 values ('21474836461','21474836461');
567
ERROR 22003: Out of range value for column 'c1' at row 1
568
insert into t1 values ('-21474836461','-21474836461');
569
ERROR 22003: Out of range value for column 'c1' at row 1
573
select left(1234, 3) + 0;
576
create table t1 (a int not null primary key, b varchar(40), c datetime);
577
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
578
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
582
select trim(null from 'kate') as "must_be_null";
585
select trim('xyz' from null) as "must_be_null";
588
select trim(leading NULL from 'kate') as "must_be_null";
591
select trim(trailing NULL from 'xyz') as "must_be_null";
595
id int NOT NULL auto_increment,
596
a bigint default NULL,
599
INSERT INTO t1 VALUES ('0','16307858876001849059');
600
ERROR 22003: Out of range value for column 'a' at row 1
601
SELECT CONV('e251273eb74a8ee3', 16, 10);
602
CONV('e251273eb74a8ee3', 16, 10)
607
WHERE a = 16307858876001849059;
608
id select_type table type possible_keys key key_len ref rows Extra
609
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
613
WHERE a = CONV('e251273eb74a8ee3', 16, 10);
614
id select_type table type possible_keys key key_len ref rows Extra
615
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
617
SELECT CHAR(NULL,121,83,81,'76') as my_column;
620
SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column;
623
CREATE TABLE t1 (id int PRIMARY KEY, str char(255) NOT NULL);
624
CREATE TABLE t2 (id int NOT NULL UNIQUE);
625
INSERT INTO t2 VALUES (1),(2);
626
INSERT INTO t1 VALUES (2, 'not valid');
628
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
629
field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
631
select field(NULL,1,2,NULL), field(NULL,1,2,0);
632
field(NULL,1,2,NULL) field(NULL,1,2,0)
634
CREATE TABLE t1 (str varchar(20) PRIMARY KEY);
635
CREATE TABLE t2 (num int primary key);
636
INSERT INTO t1 VALUES ('notnumber');
637
INSERT INTO t2 VALUES (0), (1);
638
SELECT * FROM t1, t2 WHERE num=str;
641
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
646
id int NOT NULL auto_increment,
647
pc int NOT NULL default '0',
648
title varchar(20) default NULL,
651
INSERT INTO t1 VALUES
655
SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1
656
FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id
657
LEFT JOIN t1 AS t3 ON t2.pc=t3.id;
662
SELECT t1.id, CONCAT_WS('->', t3.title, t2.title, t1.title) as col1
663
FROM t1 LEFT JOIN t1 AS t2 ON t1.pc=t2.id
664
LEFT JOIN t1 AS t3 ON t2.pc=t3.id
665
WHERE CONCAT_WS('->', t3.title, t2.title, t1.title) LIKE '%Toys%';
670
trackid int NOT NULL auto_increment,
671
trackname varchar(100) NOT NULL default '',
672
PRIMARY KEY (trackid)
675
artistid int NOT NULL auto_increment,
676
artistname varchar(100) NOT NULL default '',
677
PRIMARY KEY (artistid)
680
trackid int NOT NULL,
681
artistid int NOT NULL,
682
PRIMARY KEY (trackid,artistid)
684
INSERT INTO t1 VALUES (1, 'April In Paris'), (2, 'Autumn In New York');
685
INSERT INTO t2 VALUES (1, 'Vernon Duke');
686
INSERT INTO t3 VALUES (1,1);
687
SELECT CONCAT_WS(' ', trackname, artistname) trackname, artistname
688
FROM t1 LEFT JOIN t3 ON t1.trackid=t3.trackid
689
LEFT JOIN t2 ON t2.artistid=t3.artistid
690
WHERE CONCAT_WS(' ', trackname, artistname) LIKE '%In%';
692
April In Paris Vernon Duke Vernon Duke
693
Autumn In New York NULL
695
create table t1 (b varchar(5));
696
insert t1 values ('ab'), ('abc'), ('abcd'), ('abcde');
697
select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1;
698
b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
701
abcd abcd d cd bcd abcd
702
abcde abcde e de cde bcde abcde
703
select * from (select *,substring(b,1),substring(b,-1),substring(b,-2),substring(b,-3),substring(b,-4),substring(b,-5) from t1) t;
704
b substring(b,1) substring(b,-1) substring(b,-2) substring(b,-3) substring(b,-4) substring(b,-5)
707
abcd abcd d cd bcd abcd
708
abcde abcde e de cde bcde abcde
710
select hex(29223372036854775809), hex(-29223372036854775809);
711
hex(29223372036854775809) hex(-29223372036854775809)
712
FFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFF
713
create table t1 (i int);
714
insert into t1 values (1000000000),(1);
715
select lpad(i, 7, ' ') as t from t1;
716
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
717
def t 9 7 7 Y 128 31 63
721
select rpad(i, 7, ' ') as t from t1;
722
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
723
def t 9 7 7 Y 128 31 63
728
select load_file("lkjlkj");
731
select ifnull(load_file("lkjlkj"),"it's null");
732
ifnull(load_file("lkjlkj"),"it's null")
734
CREATE TABLE t1 (a varchar(10));
735
INSERT INTO t1 VALUES ('abc'), ('xyz');
736
SELECT a, CONCAT(a,' ',a) AS c FROM t1
737
HAVING LEFT(c,LENGTH(c)-INSTR(REVERSE(c)," ")) = a;
741
SELECT a, CONCAT(a,' ',a) AS c FROM t1
742
HAVING LEFT(CONCAT(a,' ',a),
743
LENGTH(CONCAT(a,' ',a))-
744
INSTR(REVERSE(CONCAT(a,' ',a))," ")) = a;
749
CREATE TABLE t1 (s varchar(10));
750
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
751
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
752
id select_type table type possible_keys key key_len ref rows filtered Extra
753
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
755
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(`test`.`t1`.`s`) > 'ab')
756
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
757
id select_type table type possible_keys key key_len ref rows filtered Extra
758
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
760
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
761
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
762
id select_type table type possible_keys key key_len ref rows filtered Extra
763
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
765
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(leading 'y' from `test`.`t1`.`s`) > 'ab')
766
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
767
id select_type table type possible_keys key key_len ref rows filtered Extra
768
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
770
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(trailing 'y' from `test`.`t1`.`s`) > 'ab')
771
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
772
id select_type table type possible_keys key key_len ref rows filtered Extra
773
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
775
Note 1003 select `test`.`t1`.`s` AS `s` from `test`.`t1` where (trim(both 'y' from `test`.`t1`.`s`) > 'ab')
777
create table t1 (a bigint not null)engine=myisam;
778
insert into t1 set a = 1024*1024*1024*4;
780
create table t1 (a char(36) not null)engine=myisam;
781
insert ignore into t1 set a = ' ';
782
insert ignore into t1 set a = ' ';
783
select * from t1 order by (oct(a));
789
create table t1 (d decimal default null);
790
insert into t1 values (null);
791
select format(d, 2) from t1;
795
create table t1 (c varchar(40));
796
insert into t1 values ('y,abc'),('y,abc');
797
select c, substring_index(lcase(c), @q:=',', -1) as res from t1;
802
select cast(rtrim(' 20.06 ') as decimal(19,2));
803
cast(rtrim(' 20.06 ') as decimal(19,2))
805
select cast(ltrim(' 20.06 ') as decimal(19,2));
806
cast(ltrim(' 20.06 ') as decimal(19,2))
808
select cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2));
809
cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
811
select conv("18383815659218730760",10,10) + 0;
812
conv("18383815659218730760",10,10) + 0
814
select "18383815659218730760" + 0;
815
"18383815659218730760" + 0
817
CREATE TABLE t1 (code varchar(10));
818
INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
819
SELECT ASCII(code), code FROM t1 WHERE code='A12';
823
SELECT ASCII(code), code FROM t1 WHERE code='A12' AND ASCII(code)=65;
826
INSERT INTO t1 VALUES ('a12 '), ('A12 ');
827
SELECT LENGTH(code), code FROM t1 WHERE code='A12';
833
SELECT LENGTH(code), code FROM t1 WHERE code='A12' AND LENGTH(code)=5;
836
ALTER TABLE t1 ADD INDEX (code);
837
CREATE TABLE t2 (id varchar(10) PRIMARY KEY);
838
INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14');
839
SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id
840
WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00');
844
SELECT * FROM t1 INNER JOIN t2 ON code=id
845
WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');
846
id select_type table type possible_keys key key_len ref rows filtered Extra
847
1 SIMPLE t2 const PRIMARY PRIMARY 42 const 1 100.00 Using index
848
1 SIMPLE t1 ref code code 43 const 2 100.00 Using where; Using index
850
Note 1003 select `test`.`t1`.`code` AS `code`,'a12' AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = 'a12') and ('a12' = 'a12') and ((length(`test`.`t1`.`code`) = 5) or ('a12' < 'a00')))
852
select benchmark(-1, 1);
856
Error 1411 Incorrect count value: '-1' for function benchmark
858
select format(pi(), (1+1));
861
select format(pi(), (select 3));
862
format(pi(), (select 3))
864
select format(pi(), @dec);
868
select benchmark(10, pi());
871
select benchmark(5+5, pi());
874
select benchmark((select 10), pi());
875
benchmark((select 10), pi())
877
select benchmark(@bench_count, pi());
878
benchmark(@bench_count, pi())
880
select locate('he','hello',-2);
881
locate('he','hello',-2)
883
select locate('lo','hello',-4294967295);
884
locate('lo','hello',-4294967295)
886
select locate('lo','hello',4294967295);
887
locate('lo','hello',4294967295)
889
select locate('lo','hello',-4294967296);
890
locate('lo','hello',-4294967296)
892
select locate('lo','hello',4294967296);
893
locate('lo','hello',4294967296)
895
select locate('lo','hello',-4294967297);
896
locate('lo','hello',-4294967297)
898
select locate('lo','hello',4294967297);
899
locate('lo','hello',4294967297)
901
select locate('lo','hello',-18446744073709551615);
902
locate('lo','hello',-18446744073709551615)
905
Error 1292 Truncated incorrect DECIMAL value: ''
906
select locate('lo','hello',18446744073709551615);
907
locate('lo','hello',18446744073709551615)
909
select locate('lo','hello',-18446744073709551616);
910
locate('lo','hello',-18446744073709551616)
913
Error 1292 Truncated incorrect DECIMAL value: ''
914
select locate('lo','hello',18446744073709551616);
915
locate('lo','hello',18446744073709551616)
918
Error 1292 Truncated incorrect DECIMAL value: ''
919
select locate('lo','hello',-18446744073709551617);
920
locate('lo','hello',-18446744073709551617)
923
Error 1292 Truncated incorrect DECIMAL value: ''
924
select locate('lo','hello',18446744073709551617);
925
locate('lo','hello',18446744073709551617)
928
Error 1292 Truncated incorrect DECIMAL value: ''
929
select left('hello', 10);
932
select left('hello', 0);
935
select left('hello', -1);
938
select left('hello', -4294967295);
939
left('hello', -4294967295)
941
select left('hello', 4294967295);
942
left('hello', 4294967295)
944
select left('hello', -4294967296);
945
left('hello', -4294967296)
947
select left('hello', 4294967296);
948
left('hello', 4294967296)
950
select left('hello', -4294967297);
951
left('hello', -4294967297)
953
select left('hello', 4294967297);
954
left('hello', 4294967297)
956
select left('hello', -18446744073709551615);
957
left('hello', -18446744073709551615)
960
Error 1292 Truncated incorrect DECIMAL value: ''
961
Error 1292 Truncated incorrect DECIMAL value: ''
962
select left('hello', 18446744073709551615);
963
left('hello', 18446744073709551615)
965
select left('hello', -18446744073709551616);
966
left('hello', -18446744073709551616)
969
Error 1292 Truncated incorrect DECIMAL value: ''
970
Error 1292 Truncated incorrect DECIMAL value: ''
971
select left('hello', 18446744073709551616);
972
left('hello', 18446744073709551616)
975
Error 1292 Truncated incorrect DECIMAL value: ''
976
Error 1292 Truncated incorrect DECIMAL value: ''
977
select left('hello', -18446744073709551617);
978
left('hello', -18446744073709551617)
981
Error 1292 Truncated incorrect DECIMAL value: ''
982
Error 1292 Truncated incorrect DECIMAL value: ''
983
select left('hello', 18446744073709551617);
984
left('hello', 18446744073709551617)
987
Error 1292 Truncated incorrect DECIMAL value: ''
988
Error 1292 Truncated incorrect DECIMAL value: ''
989
select right('hello', 10);
992
select right('hello', 0);
995
select right('hello', -1);
998
select right('hello', -4294967295);
999
right('hello', -4294967295)
1001
select right('hello', 4294967295);
1002
right('hello', 4294967295)
1004
select right('hello', -4294967296);
1005
right('hello', -4294967296)
1007
select right('hello', 4294967296);
1008
right('hello', 4294967296)
1010
select right('hello', -4294967297);
1011
right('hello', -4294967297)
1013
select right('hello', 4294967297);
1014
right('hello', 4294967297)
1016
select right('hello', -18446744073709551615);
1017
right('hello', -18446744073709551615)
1020
Error 1292 Truncated incorrect DECIMAL value: ''
1021
Error 1292 Truncated incorrect DECIMAL value: ''
1022
select right('hello', 18446744073709551615);
1023
right('hello', 18446744073709551615)
1025
select right('hello', -18446744073709551616);
1026
right('hello', -18446744073709551616)
1029
Error 1292 Truncated incorrect DECIMAL value: ''
1030
Error 1292 Truncated incorrect DECIMAL value: ''
1031
select right('hello', 18446744073709551616);
1032
right('hello', 18446744073709551616)
1035
Error 1292 Truncated incorrect DECIMAL value: ''
1036
Error 1292 Truncated incorrect DECIMAL value: ''
1037
select right('hello', -18446744073709551617);
1038
right('hello', -18446744073709551617)
1041
Error 1292 Truncated incorrect DECIMAL value: ''
1042
Error 1292 Truncated incorrect DECIMAL value: ''
1043
select right('hello', 18446744073709551617);
1044
right('hello', 18446744073709551617)
1047
Error 1292 Truncated incorrect DECIMAL value: ''
1048
Error 1292 Truncated incorrect DECIMAL value: ''
1049
select substring('hello', 2, -1);
1050
substring('hello', 2, -1)
1052
select substring('hello', -1, 1);
1053
substring('hello', -1, 1)
1055
select substring('hello', -2, 1);
1056
substring('hello', -2, 1)
1058
select substring('hello', -4294967295, 1);
1059
substring('hello', -4294967295, 1)
1061
select substring('hello', 4294967295, 1);
1062
substring('hello', 4294967295, 1)
1064
select substring('hello', -4294967296, 1);
1065
substring('hello', -4294967296, 1)
1067
select substring('hello', 4294967296, 1);
1068
substring('hello', 4294967296, 1)
1070
select substring('hello', -4294967297, 1);
1071
substring('hello', -4294967297, 1)
1073
select substring('hello', 4294967297, 1);
1074
substring('hello', 4294967297, 1)
1076
select substring('hello', -18446744073709551615, 1);
1077
substring('hello', -18446744073709551615, 1)
1080
Error 1292 Truncated incorrect DECIMAL value: ''
1081
Error 1292 Truncated incorrect DECIMAL value: ''
1082
select substring('hello', 18446744073709551615, 1);
1083
substring('hello', 18446744073709551615, 1)
1085
select substring('hello', -18446744073709551616, 1);
1086
substring('hello', -18446744073709551616, 1)
1089
Error 1292 Truncated incorrect DECIMAL value: ''
1090
Error 1292 Truncated incorrect DECIMAL value: ''
1091
select substring('hello', 18446744073709551616, 1);
1092
substring('hello', 18446744073709551616, 1)
1095
Error 1292 Truncated incorrect DECIMAL value: ''
1096
Error 1292 Truncated incorrect DECIMAL value: ''
1097
select substring('hello', -18446744073709551617, 1);
1098
substring('hello', -18446744073709551617, 1)
1101
Error 1292 Truncated incorrect DECIMAL value: ''
1102
Error 1292 Truncated incorrect DECIMAL value: ''
1103
select substring('hello', 18446744073709551617, 1);
1104
substring('hello', 18446744073709551617, 1)
1107
Error 1292 Truncated incorrect DECIMAL value: ''
1108
Error 1292 Truncated incorrect DECIMAL value: ''
1109
select substring('hello', 1, -1);
1110
substring('hello', 1, -1)
1112
select substring('hello', 1, -4294967295);
1113
substring('hello', 1, -4294967295)
1115
select substring('hello', 1, 4294967295);
1116
substring('hello', 1, 4294967295)
1118
select substring('hello', 1, -4294967296);
1119
substring('hello', 1, -4294967296)
1121
select substring('hello', 1, 4294967296);
1122
substring('hello', 1, 4294967296)
1124
select substring('hello', 1, -4294967297);
1125
substring('hello', 1, -4294967297)
1127
select substring('hello', 1, 4294967297);
1128
substring('hello', 1, 4294967297)
1130
select substring('hello', 1, -18446744073709551615);
1131
substring('hello', 1, -18446744073709551615)
1134
Error 1292 Truncated incorrect DECIMAL value: ''
1135
Error 1292 Truncated incorrect DECIMAL value: ''
1136
select substring('hello', 1, 18446744073709551615);
1137
substring('hello', 1, 18446744073709551615)
1139
select substring('hello', 1, -18446744073709551616);
1140
substring('hello', 1, -18446744073709551616)
1143
Error 1292 Truncated incorrect DECIMAL value: ''
1144
Error 1292 Truncated incorrect DECIMAL value: ''
1145
select substring('hello', 1, 18446744073709551616);
1146
substring('hello', 1, 18446744073709551616)
1149
Error 1292 Truncated incorrect DECIMAL value: ''
1150
Error 1292 Truncated incorrect DECIMAL value: ''
1151
select substring('hello', 1, -18446744073709551617);
1152
substring('hello', 1, -18446744073709551617)
1155
Error 1292 Truncated incorrect DECIMAL value: ''
1156
Error 1292 Truncated incorrect DECIMAL value: ''
1157
select substring('hello', 1, 18446744073709551617);
1158
substring('hello', 1, 18446744073709551617)
1161
Error 1292 Truncated incorrect DECIMAL value: ''
1162
Error 1292 Truncated incorrect DECIMAL value: ''
1163
select substring('hello', -1, -1);
1164
substring('hello', -1, -1)
1166
select substring('hello', -4294967295, -4294967295);
1167
substring('hello', -4294967295, -4294967295)
1169
select substring('hello', 4294967295, 4294967295);
1170
substring('hello', 4294967295, 4294967295)
1172
select substring('hello', -4294967296, -4294967296);
1173
substring('hello', -4294967296, -4294967296)
1175
select substring('hello', 4294967296, 4294967296);
1176
substring('hello', 4294967296, 4294967296)
1178
select substring('hello', -4294967297, -4294967297);
1179
substring('hello', -4294967297, -4294967297)
1181
select substring('hello', 4294967297, 4294967297);
1182
substring('hello', 4294967297, 4294967297)
1184
select substring('hello', -18446744073709551615, -18446744073709551615);
1185
substring('hello', -18446744073709551615, -18446744073709551615)
1188
Error 1292 Truncated incorrect DECIMAL value: ''
1189
Error 1292 Truncated incorrect DECIMAL value: ''
1190
Error 1292 Truncated incorrect DECIMAL value: ''
1191
Error 1292 Truncated incorrect DECIMAL value: ''
1192
select substring('hello', 18446744073709551615, 18446744073709551615);
1193
substring('hello', 18446744073709551615, 18446744073709551615)
1195
select substring('hello', -18446744073709551616, -18446744073709551616);
1196
substring('hello', -18446744073709551616, -18446744073709551616)
1199
Error 1292 Truncated incorrect DECIMAL value: ''
1200
Error 1292 Truncated incorrect DECIMAL value: ''
1201
Error 1292 Truncated incorrect DECIMAL value: ''
1202
Error 1292 Truncated incorrect DECIMAL value: ''
1203
select substring('hello', 18446744073709551616, 18446744073709551616);
1204
substring('hello', 18446744073709551616, 18446744073709551616)
1207
Error 1292 Truncated incorrect DECIMAL value: ''
1208
Error 1292 Truncated incorrect DECIMAL value: ''
1209
Error 1292 Truncated incorrect DECIMAL value: ''
1210
Error 1292 Truncated incorrect DECIMAL value: ''
1211
select substring('hello', -18446744073709551617, -18446744073709551617);
1212
substring('hello', -18446744073709551617, -18446744073709551617)
1215
Error 1292 Truncated incorrect DECIMAL value: ''
1216
Error 1292 Truncated incorrect DECIMAL value: ''
1217
Error 1292 Truncated incorrect DECIMAL value: ''
1218
Error 1292 Truncated incorrect DECIMAL value: ''
1219
select substring('hello', 18446744073709551617, 18446744073709551617);
1220
substring('hello', 18446744073709551617, 18446744073709551617)
1223
Error 1292 Truncated incorrect DECIMAL value: ''
1224
Error 1292 Truncated incorrect DECIMAL value: ''
1225
Error 1292 Truncated incorrect DECIMAL value: ''
1226
Error 1292 Truncated incorrect DECIMAL value: ''
1227
select insert('hello', -1, 1, 'hi');
1228
insert('hello', -1, 1, 'hi')
1230
select insert('hello', -4294967295, 1, 'hi');
1231
insert('hello', -4294967295, 1, 'hi')
1233
select insert('hello', 4294967295, 1, 'hi');
1234
insert('hello', 4294967295, 1, 'hi')
1236
select insert('hello', -4294967296, 1, 'hi');
1237
insert('hello', -4294967296, 1, 'hi')
1239
select insert('hello', 4294967296, 1, 'hi');
1240
insert('hello', 4294967296, 1, 'hi')
1242
select insert('hello', -4294967297, 1, 'hi');
1243
insert('hello', -4294967297, 1, 'hi')
1245
select insert('hello', 4294967297, 1, 'hi');
1246
insert('hello', 4294967297, 1, 'hi')
1248
select insert('hello', -18446744073709551615, 1, 'hi');
1249
insert('hello', -18446744073709551615, 1, 'hi')
1252
Error 1292 Truncated incorrect DECIMAL value: ''
1253
select insert('hello', 18446744073709551615, 1, 'hi');
1254
insert('hello', 18446744073709551615, 1, 'hi')
1256
select insert('hello', -18446744073709551616, 1, 'hi');
1257
insert('hello', -18446744073709551616, 1, 'hi')
1260
Error 1292 Truncated incorrect DECIMAL value: ''
1261
select insert('hello', 18446744073709551616, 1, 'hi');
1262
insert('hello', 18446744073709551616, 1, 'hi')
1265
Error 1292 Truncated incorrect DECIMAL value: ''
1266
select insert('hello', -18446744073709551617, 1, 'hi');
1267
insert('hello', -18446744073709551617, 1, 'hi')
1270
Error 1292 Truncated incorrect DECIMAL value: ''
1271
select insert('hello', 18446744073709551617, 1, 'hi');
1272
insert('hello', 18446744073709551617, 1, 'hi')
1275
Error 1292 Truncated incorrect DECIMAL value: ''
1276
select insert('hello', 1, -1, 'hi');
1277
insert('hello', 1, -1, 'hi')
1279
select insert('hello', 1, -4294967295, 'hi');
1280
insert('hello', 1, -4294967295, 'hi')
1282
select insert('hello', 1, 4294967295, 'hi');
1283
insert('hello', 1, 4294967295, 'hi')
1285
select insert('hello', 1, -4294967296, 'hi');
1286
insert('hello', 1, -4294967296, 'hi')
1288
select insert('hello', 1, 4294967296, 'hi');
1289
insert('hello', 1, 4294967296, 'hi')
1291
select insert('hello', 1, -4294967297, 'hi');
1292
insert('hello', 1, -4294967297, 'hi')
1294
select insert('hello', 1, 4294967297, 'hi');
1295
insert('hello', 1, 4294967297, 'hi')
1297
select insert('hello', 1, -18446744073709551615, 'hi');
1298
insert('hello', 1, -18446744073709551615, 'hi')
1301
Error 1292 Truncated incorrect DECIMAL value: ''
1302
select insert('hello', 1, 18446744073709551615, 'hi');
1303
insert('hello', 1, 18446744073709551615, 'hi')
1305
select insert('hello', 1, -18446744073709551616, 'hi');
1306
insert('hello', 1, -18446744073709551616, 'hi')
1309
Error 1292 Truncated incorrect DECIMAL value: ''
1310
select insert('hello', 1, 18446744073709551616, 'hi');
1311
insert('hello', 1, 18446744073709551616, 'hi')
1314
Error 1292 Truncated incorrect DECIMAL value: ''
1315
select insert('hello', 1, -18446744073709551617, 'hi');
1316
insert('hello', 1, -18446744073709551617, 'hi')
1319
Error 1292 Truncated incorrect DECIMAL value: ''
1320
select insert('hello', 1, 18446744073709551617, 'hi');
1321
insert('hello', 1, 18446744073709551617, 'hi')
1324
Error 1292 Truncated incorrect DECIMAL value: ''
1325
select insert('hello', -1, -1, 'hi');
1326
insert('hello', -1, -1, 'hi')
1328
select insert('hello', -4294967295, -4294967295, 'hi');
1329
insert('hello', -4294967295, -4294967295, 'hi')
1331
select insert('hello', 4294967295, 4294967295, 'hi');
1332
insert('hello', 4294967295, 4294967295, 'hi')
1334
select insert('hello', -4294967296, -4294967296, 'hi');
1335
insert('hello', -4294967296, -4294967296, 'hi')
1337
select insert('hello', 4294967296, 4294967296, 'hi');
1338
insert('hello', 4294967296, 4294967296, 'hi')
1340
select insert('hello', -4294967297, -4294967297, 'hi');
1341
insert('hello', -4294967297, -4294967297, 'hi')
1343
select insert('hello', 4294967297, 4294967297, 'hi');
1344
insert('hello', 4294967297, 4294967297, 'hi')
1346
select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
1347
insert('hello', -18446744073709551615, -18446744073709551615, 'hi')
1350
Error 1292 Truncated incorrect DECIMAL value: ''
1351
Error 1292 Truncated incorrect DECIMAL value: ''
1352
select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
1353
insert('hello', 18446744073709551615, 18446744073709551615, 'hi')
1355
select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
1356
insert('hello', -18446744073709551616, -18446744073709551616, 'hi')
1359
Error 1292 Truncated incorrect DECIMAL value: ''
1360
Error 1292 Truncated incorrect DECIMAL value: ''
1361
select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
1362
insert('hello', 18446744073709551616, 18446744073709551616, 'hi')
1365
Error 1292 Truncated incorrect DECIMAL value: ''
1366
Error 1292 Truncated incorrect DECIMAL value: ''
1367
select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
1368
insert('hello', -18446744073709551617, -18446744073709551617, 'hi')
1371
Error 1292 Truncated incorrect DECIMAL value: ''
1372
Error 1292 Truncated incorrect DECIMAL value: ''
1373
select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
1374
insert('hello', 18446744073709551617, 18446744073709551617, 'hi')
1377
Error 1292 Truncated incorrect DECIMAL value: ''
1378
Error 1292 Truncated incorrect DECIMAL value: ''
1379
select repeat('hello', -1);
1382
select repeat('hello', -4294967295);
1383
repeat('hello', -4294967295)
1385
select repeat('hello', 4294967295);
1386
repeat('hello', 4294967295)
1389
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1390
select repeat('hello', -4294967296);
1391
repeat('hello', -4294967296)
1393
select repeat('hello', 4294967296);
1394
repeat('hello', 4294967296)
1397
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1398
select repeat('hello', -4294967297);
1399
repeat('hello', -4294967297)
1401
select repeat('hello', 4294967297);
1402
repeat('hello', 4294967297)
1405
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1406
select repeat('hello', -18446744073709551615);
1407
repeat('hello', -18446744073709551615)
1410
Error 1292 Truncated incorrect DECIMAL value: ''
1411
Error 1292 Truncated incorrect DECIMAL value: ''
1412
select repeat('hello', 18446744073709551615);
1413
repeat('hello', 18446744073709551615)
1416
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1417
select repeat('hello', -18446744073709551616);
1418
repeat('hello', -18446744073709551616)
1421
Error 1292 Truncated incorrect DECIMAL value: ''
1422
Error 1292 Truncated incorrect DECIMAL value: ''
1423
select repeat('hello', 18446744073709551616);
1424
repeat('hello', 18446744073709551616)
1427
Error 1292 Truncated incorrect DECIMAL value: ''
1428
Error 1292 Truncated incorrect DECIMAL value: ''
1429
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1430
select repeat('hello', -18446744073709551617);
1431
repeat('hello', -18446744073709551617)
1434
Error 1292 Truncated incorrect DECIMAL value: ''
1435
Error 1292 Truncated incorrect DECIMAL value: ''
1436
select repeat('hello', 18446744073709551617);
1437
repeat('hello', 18446744073709551617)
1440
Error 1292 Truncated incorrect DECIMAL value: ''
1441
Error 1292 Truncated incorrect DECIMAL value: ''
1442
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1446
select space(-4294967295);
1449
select space(4294967295);
1453
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1454
select space(-4294967296);
1457
select space(4294967296);
1461
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1462
select space(-4294967297);
1465
select space(4294967297);
1469
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1470
select space(-18446744073709551615);
1471
space(-18446744073709551615)
1474
Error 1292 Truncated incorrect DECIMAL value: ''
1475
Error 1292 Truncated incorrect DECIMAL value: ''
1476
select space(18446744073709551615);
1477
space(18446744073709551615)
1480
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1481
select space(-18446744073709551616);
1482
space(-18446744073709551616)
1485
Error 1292 Truncated incorrect DECIMAL value: ''
1486
Error 1292 Truncated incorrect DECIMAL value: ''
1487
select space(18446744073709551616);
1488
space(18446744073709551616)
1491
Error 1292 Truncated incorrect DECIMAL value: ''
1492
Error 1292 Truncated incorrect DECIMAL value: ''
1493
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1494
select space(-18446744073709551617);
1495
space(-18446744073709551617)
1498
Error 1292 Truncated incorrect DECIMAL value: ''
1499
Error 1292 Truncated incorrect DECIMAL value: ''
1500
select space(18446744073709551617);
1501
space(18446744073709551617)
1504
Error 1292 Truncated incorrect DECIMAL value: ''
1505
Error 1292 Truncated incorrect DECIMAL value: ''
1506
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
1507
select rpad('hello', -1, '1');
1508
rpad('hello', -1, '1')
1510
select rpad('hello', -4294967295, '1');
1511
rpad('hello', -4294967295, '1')
1513
select rpad('hello', 4294967295, '1');
1514
rpad('hello', 4294967295, '1')
1517
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1518
select rpad('hello', -4294967296, '1');
1519
rpad('hello', -4294967296, '1')
1521
select rpad('hello', 4294967296, '1');
1522
rpad('hello', 4294967296, '1')
1525
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1526
select rpad('hello', -4294967297, '1');
1527
rpad('hello', -4294967297, '1')
1529
select rpad('hello', 4294967297, '1');
1530
rpad('hello', 4294967297, '1')
1533
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1534
select rpad('hello', -18446744073709551615, '1');
1535
rpad('hello', -18446744073709551615, '1')
1538
Error 1292 Truncated incorrect DECIMAL value: ''
1539
Error 1292 Truncated incorrect DECIMAL value: ''
1540
select rpad('hello', 18446744073709551615, '1');
1541
rpad('hello', 18446744073709551615, '1')
1544
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1545
select rpad('hello', -18446744073709551616, '1');
1546
rpad('hello', -18446744073709551616, '1')
1549
Error 1292 Truncated incorrect DECIMAL value: ''
1550
Error 1292 Truncated incorrect DECIMAL value: ''
1551
select rpad('hello', 18446744073709551616, '1');
1552
rpad('hello', 18446744073709551616, '1')
1555
Error 1292 Truncated incorrect DECIMAL value: ''
1556
Error 1292 Truncated incorrect DECIMAL value: ''
1557
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1558
select rpad('hello', -18446744073709551617, '1');
1559
rpad('hello', -18446744073709551617, '1')
1562
Error 1292 Truncated incorrect DECIMAL value: ''
1563
Error 1292 Truncated incorrect DECIMAL value: ''
1564
select rpad('hello', 18446744073709551617, '1');
1565
rpad('hello', 18446744073709551617, '1')
1568
Error 1292 Truncated incorrect DECIMAL value: ''
1569
Error 1292 Truncated incorrect DECIMAL value: ''
1570
Warning 1301 Result of rpad() was larger than max_allowed_packet (1048576) - truncated
1571
select lpad('hello', -1, '1');
1572
lpad('hello', -1, '1')
1574
select lpad('hello', -4294967295, '1');
1575
lpad('hello', -4294967295, '1')
1577
select lpad('hello', 4294967295, '1');
1578
lpad('hello', 4294967295, '1')
1581
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1582
select lpad('hello', -4294967296, '1');
1583
lpad('hello', -4294967296, '1')
1585
select lpad('hello', 4294967296, '1');
1586
lpad('hello', 4294967296, '1')
1589
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1590
select lpad('hello', -4294967297, '1');
1591
lpad('hello', -4294967297, '1')
1593
select lpad('hello', 4294967297, '1');
1594
lpad('hello', 4294967297, '1')
1597
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1598
select lpad('hello', -18446744073709551615, '1');
1599
lpad('hello', -18446744073709551615, '1')
1602
Error 1292 Truncated incorrect DECIMAL value: ''
1603
Error 1292 Truncated incorrect DECIMAL value: ''
1604
select lpad('hello', 18446744073709551615, '1');
1605
lpad('hello', 18446744073709551615, '1')
1608
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1609
select lpad('hello', -18446744073709551616, '1');
1610
lpad('hello', -18446744073709551616, '1')
1613
Error 1292 Truncated incorrect DECIMAL value: ''
1614
Error 1292 Truncated incorrect DECIMAL value: ''
1615
select lpad('hello', 18446744073709551616, '1');
1616
lpad('hello', 18446744073709551616, '1')
1619
Error 1292 Truncated incorrect DECIMAL value: ''
1620
Error 1292 Truncated incorrect DECIMAL value: ''
1621
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1622
select lpad('hello', -18446744073709551617, '1');
1623
lpad('hello', -18446744073709551617, '1')
1626
Error 1292 Truncated incorrect DECIMAL value: ''
1627
Error 1292 Truncated incorrect DECIMAL value: ''
1628
select lpad('hello', 18446744073709551617, '1');
1629
lpad('hello', 18446744073709551617, '1')
1632
Error 1292 Truncated incorrect DECIMAL value: ''
1633
Error 1292 Truncated incorrect DECIMAL value: ''
1634
Warning 1301 Result of lpad() was larger than max_allowed_packet (1048576) - truncated
1635
SELECT CHAR(0xff,0x8f);
1638
SELECT CHAR(0xff,0x8f) IS NULL;
1639
CHAR(0xff,0x8f) IS NULL
1641
create table t1(f1 longtext);
1642
insert into t1 values ("123"),("456");
1643
select substring(f1,1,1) from t1 group by 1;
1647
create table t2(f1 varchar(3));
1648
insert into t1 values ("123"),("456");
1649
select substring(f1,4,1), substring(f1,-4,1) from t2;
1650
substring(f1,4,1) substring(f1,-4,1)
1652
DROP TABLE IF EXISTS t1;
1654
`id` varchar(20) NOT NULL,
1655
`tire` int NOT NULL,
1658
INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
1659
SELECT REPEAT( '#', tire ) AS A,
1660
REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
1665
SELECT REPEAT('0', 0);
1668
SELECT REPEAT('0', -2);
1671
SELECT REPEAT('0', 2);
1678
SELECT UNHEX('G') IS NULL;
1681
SELECT INSERT('abc', 3, 3, '1234');
1682
INSERT('abc', 3, 3, '1234')
1684
SELECT INSERT('abc', 4, 3, '1234');
1685
INSERT('abc', 4, 3, '1234')
1687
SELECT INSERT('abc', 5, 3, '1234');
1688
INSERT('abc', 5, 3, '1234')
1690
SELECT INSERT('abc', 6, 3, '1234');
1691
INSERT('abc', 6, 3, '1234')
1693
SELECT LOCATE('foo', NULL);
1696
SELECT LOCATE(NULL, 'o');
1699
SELECT LOCATE(NULL, NULL);
1702
SELECT LOCATE('foo', NULL) IS NULL;
1703
LOCATE('foo', NULL) IS NULL
1705
SELECT LOCATE(NULL, 'o') IS NULL;
1706
LOCATE(NULL, 'o') IS NULL
1708
SELECT LOCATE(NULL, NULL) IS NULL;
1709
LOCATE(NULL, NULL) IS NULL
1711
SELECT ISNULL(LOCATE('foo', NULL));
1712
ISNULL(LOCATE('foo', NULL))
1714
SELECT ISNULL(LOCATE(NULL, 'o'));
1715
ISNULL(LOCATE(NULL, 'o'))
1717
SELECT ISNULL(LOCATE(NULL, NULL));
1718
ISNULL(LOCATE(NULL, NULL))
1720
SELECT LOCATE('foo', NULL) <=> NULL;
1721
LOCATE('foo', NULL) <=> NULL
1723
SELECT LOCATE(NULL, 'o') <=> NULL;
1724
LOCATE(NULL, 'o') <=> NULL
1726
SELECT LOCATE(NULL, NULL) <=> NULL;
1727
LOCATE(NULL, NULL) <=> NULL
1729
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a varchar(10), p varchar(10));
1730
INSERT INTO t1 VALUES (1, 'foo', 'o');
1731
INSERT INTO t1 VALUES (2, 'foo', NULL);
1732
INSERT INTO t1 VALUES (3, NULL, 'o');
1733
INSERT INTO t1 VALUES (4, NULL, NULL);
1734
SELECT id, LOCATE(a,p) FROM t1;
1740
SELECT id, LOCATE(a,p) IS NULL FROM t1;
1741
id LOCATE(a,p) IS NULL
1746
SELECT id, ISNULL(LOCATE(a,p)) FROM t1;
1747
id ISNULL(LOCATE(a,p))
1752
SELECT id, LOCATE(a,p) <=> NULL FROM t1;
1753
id LOCATE(a,p) <=> NULL
1758
SELECT id FROM t1 WHERE LOCATE(a,p) IS NULL;
1763
SELECT id FROM t1 WHERE LOCATE(a,p) <=> NULL;
1769
SELECT SUBSTR('foo',1,0);
1772
SELECT SUBSTR('foo',1,0);
1775
SELECT SUBSTR('foo',1,0);
1778
CREATE TABLE t1 (a varchar(10), len int);
1779
INSERT INTO t1 VALUES ('bar', 2), ('foo', 0);
1780
SELECT SUBSTR(a,1,len) FROM t1;
1785
CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1;
1786
SELECT HEX(c1) from t1;