1
drop table if exists t1;
3
CREATE TABLE t1 (a char(1) character set latin1);
4
INSERT INTO t1 VALUES (0x00),(0x01),(0x02),(0x03),(0x04),(0x05),(0x06),(0x07);
5
INSERT INTO t1 VALUES (0x08),(0x09),(0x0A),(0x0B),(0x0C),(0x0D),(0x0E),(0x0F);
6
INSERT INTO t1 VALUES (0x10),(0x11),(0x12),(0x13),(0x14),(0x15),(0x16),(0x17);
7
INSERT INTO t1 VALUES (0x18),(0x19),(0x1A),(0x1B),(0x1C),(0x1D),(0x1E),(0x1F);
8
INSERT INTO t1 VALUES (0x20),(0x21),(0x22),(0x23),(0x24),(0x25),(0x26),(0x27);
9
INSERT INTO t1 VALUES (0x28),(0x29),(0x2A),(0x2B),(0x2C),(0x2D),(0x2E),(0x2F);
10
INSERT INTO t1 VALUES (0x30),(0x31),(0x32),(0x33),(0x34),(0x35),(0x36),(0x37);
11
INSERT INTO t1 VALUES (0x38),(0x39),(0x3A),(0x3B),(0x3C),(0x3D),(0x3E),(0x3F);
12
INSERT INTO t1 VALUES (0x40),(0x41),(0x42),(0x43),(0x44),(0x45),(0x46),(0x47);
13
INSERT INTO t1 VALUES (0x48),(0x49),(0x4A),(0x4B),(0x4C),(0x4D),(0x4E),(0x4F);
14
INSERT INTO t1 VALUES (0x50),(0x51),(0x52),(0x53),(0x54),(0x55),(0x56),(0x57);
15
INSERT INTO t1 VALUES (0x58),(0x59),(0x5A),(0x5B),(0x5C),(0x5D),(0x5E),(0x5F);
16
INSERT INTO t1 VALUES (0x60),(0x61),(0x62),(0x63),(0x64),(0x65),(0x66),(0x67);
17
INSERT INTO t1 VALUES (0x68),(0x69),(0x6A),(0x6B),(0x6C),(0x6D),(0x6E),(0x6F);
18
INSERT INTO t1 VALUES (0x70),(0x71),(0x72),(0x73),(0x74),(0x75),(0x76),(0x77);
19
INSERT INTO t1 VALUES (0x78),(0x79),(0x7A),(0x7B),(0x7C),(0x7D),(0x7E),(0x7F);
20
INSERT INTO t1 VALUES (0x80),(0x81),(0x82),(0x83),(0x84),(0x85),(0x86),(0x87);
21
INSERT INTO t1 VALUES (0x88),(0x89),(0x8A),(0x8B),(0x8C),(0x8D),(0x8E),(0x8F);
22
INSERT INTO t1 VALUES (0x90),(0x91),(0x92),(0x93),(0x94),(0x95),(0x96),(0x97);
23
INSERT INTO t1 VALUES (0x98),(0x99),(0x9A),(0x9B),(0x9C),(0x9D),(0x9E),(0x9F);
24
INSERT INTO t1 VALUES (0xA0),(0xA1),(0xA2),(0xA3),(0xA4),(0xA5),(0xA6),(0xA7);
25
INSERT INTO t1 VALUES (0xA8),(0xA9),(0xAA),(0xAB),(0xAC),(0xAD),(0xAE),(0xAF);
26
INSERT INTO t1 VALUES (0xB0),(0xB1),(0xB2),(0xB3),(0xB4),(0xB5),(0xB6),(0xB7);
27
INSERT INTO t1 VALUES (0xB8),(0xB9),(0xBA),(0xBB),(0xBC),(0xBD),(0xBE),(0xBF);
28
INSERT INTO t1 VALUES (0xC0),(0xC1),(0xC2),(0xC3),(0xC4),(0xC5),(0xC6),(0xC7);
29
INSERT INTO t1 VALUES (0xC8),(0xC9),(0xCA),(0xCB),(0xCC),(0xCD),(0xCE),(0xCF);
30
INSERT INTO t1 VALUES (0xD0),(0xD1),(0xD2),(0xD3),(0xD4),(0xD5),(0xD6),(0xD7);
31
INSERT INTO t1 VALUES (0xD8),(0xD9),(0xDA),(0xDB),(0xDC),(0xDD),(0xDE),(0xDF);
32
INSERT INTO t1 VALUES (0xE0),(0xE1),(0xE2),(0xE3),(0xE4),(0xE5),(0xE6),(0xE7);
33
INSERT INTO t1 VALUES (0xE8),(0xE9),(0xEA),(0xEB),(0xEC),(0xED),(0xEE),(0xEF);
34
INSERT INTO t1 VALUES (0xF0),(0xF1),(0xF2),(0xF3),(0xF4),(0xF5),(0xF6),(0xF7);
35
INSERT INTO t1 VALUES (0xF8),(0xF9),(0xFA),(0xFB),(0xFC),(0xFD),(0xFE),(0xFF);
38
hex(@u:=convert(a using utf8)),
39
hex(@l:=convert(@u using latin1)),
41
hex(a) hex(@u:=convert(a using utf8)) hex(@l:=convert(@u using latin1)) a=@l
299
SELECT 1 as �, 2 as �, 3 as �, 4 as �, 5 as �, 6 as �, 7 as �, 8 as �;
302
select 'a' regexp 'A' collate latin1_general_ci;
303
'a' regexp 'A' collate latin1_general_ci
305
select 'a' regexp 'A' collate latin1_general_cs;
306
'a' regexp 'A' collate latin1_general_cs
308
select 'a' regexp 'A' collate latin1_bin;
309
'a' regexp 'A' collate latin1_bin
311
SET collation_connection='latin1_swedish_ci';
312
create table t1 select repeat('a',4000) a;
314
insert into t1 values ('a'), ('a '), ('a\t');
315
select collation(a),hex(a) from t1 order by a;
317
latin1_swedish_ci 6109
319
latin1_swedish_ci 6120
321
select @@collation_connection;
322
@@collation_connection
324
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
325
insert into t1 values('abcdef');
326
insert into t1 values('_bcdef');
327
insert into t1 values('a_cdef');
328
insert into t1 values('ab_def');
329
insert into t1 values('abc_ef');
330
insert into t1 values('abcd_f');
331
insert into t1 values('abcde_');
332
select c1 as c1u from t1 where c1 like 'ab\_def';
335
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
339
SET collation_connection='latin1_bin';
340
create table t1 select repeat('a',4000) a;
342
insert into t1 values ('a'), ('a '), ('a\t');
343
select collation(a),hex(a) from t1 order by a;
349
select @@collation_connection;
350
@@collation_connection
352
create table t1 ROW_FORMAT=DYNAMIC select repeat('a',50) as c1 ;
353
insert into t1 values('abcdef');
354
insert into t1 values('_bcdef');
355
insert into t1 values('a_cdef');
356
insert into t1 values('ab_def');
357
insert into t1 values('abc_ef');
358
insert into t1 values('abcd_f');
359
insert into t1 values('abcde_');
360
select c1 as c1u from t1 where c1 like 'ab\_def';
363
select c1 as c2h from t1 where c1 like 'ab#_def' escape '#';
367
CREATE TABLE �a (a int);
368
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '�a (a int)' at line 1
372
set @str= _latin1 'ABC ���߲��~ ������ ����� ����� @ abc';
373
SELECT convert(@str collate latin1_bin using utf8);
374
convert(@str collate latin1_bin using utf8)
375
ABC ���߲��~ ������ ����� ����� @ abc
376
SELECT convert(@str collate latin1_general_ci using utf8);
377
convert(@str collate latin1_general_ci using utf8)
378
ABC ���߲��~ ������ ����� ����� @ abc
379
SELECT convert(@str collate latin1_german1_ci using utf8);
380
convert(@str collate latin1_german1_ci using utf8)
381
ABC ���߲��~ ������ ����� ����� @ abc
382
SELECT convert(@str collate latin1_danish_ci using utf8);
383
convert(@str collate latin1_danish_ci using utf8)
384
ABC ���߲��~ ������ ����� ����� @ abc
385
SELECT convert(@str collate latin1_spanish_ci using utf8);
386
convert(@str collate latin1_spanish_ci using utf8)
387
ABC ���߲��~ ������ ����� ����� @ abc
388
SELECT convert(@str collate latin1_german2_ci using utf8);
389
convert(@str collate latin1_german2_ci using utf8)
390
ABC ���߲��~ ������ ����� ����� @ abc
391
SELECT convert(@str collate latin1_swedish_ci using utf8);
392
convert(@str collate latin1_swedish_ci using utf8)
393
ABC ���߲��~ ������ ����� ����� @ abc
395
DROP TABLE IF EXISTS `abc�def`;
396
CREATE TABLE `abc�def` (i int);
397
INSERT INTO `abc�def` VALUES (1);
398
INSERT INTO abc�def VALUES (2);
399
SELECT * FROM `abc�def`;
403
SELECT * FROM abc�def;
407
DROP TABLE `abc�def`;
408
select hex(cast(_ascii 0x7f as char(1) character set latin1));
409
hex(cast(_ascii 0x7f as char(1) character set latin1))
413
set @@collation_connection=latin1_swedish_ci;
414
select @@collation_connection;
415
@@collation_connection
417
select hex(weight_string('a'));
418
hex(weight_string('a'))
420
select hex(weight_string('A'));
421
hex(weight_string('A'))
423
select hex(weight_string('abc'));
424
hex(weight_string('abc'))
426
select hex(weight_string('abc' as char(2)));
427
hex(weight_string('abc' as char(2)))
429
select hex(weight_string('abc' as char(3)));
430
hex(weight_string('abc' as char(3)))
432
select hex(weight_string('abc' as char(5)));
433
hex(weight_string('abc' as char(5)))
435
select @@collation_connection;
436
@@collation_connection
438
select hex(weight_string('a' LEVEL 1));
439
hex(weight_string('a' LEVEL 1))
441
select hex(weight_string('A' LEVEL 1));
442
hex(weight_string('A' LEVEL 1))
444
select hex(weight_string('abc' LEVEL 1));
445
hex(weight_string('abc' LEVEL 1))
447
select hex(weight_string('abc' as char(2) LEVEL 1));
448
hex(weight_string('abc' as char(2) LEVEL 1))
450
select hex(weight_string('abc' as char(3) LEVEL 1));
451
hex(weight_string('abc' as char(3) LEVEL 1))
453
select hex(weight_string('abc' as char(5) LEVEL 1));
454
hex(weight_string('abc' as char(5) LEVEL 1))
456
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
457
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
459
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
460
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
462
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
463
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
465
set @@collation_connection=latin1_bin;
466
select @@collation_connection;
467
@@collation_connection
469
select hex(weight_string('a'));
470
hex(weight_string('a'))
472
select hex(weight_string('A'));
473
hex(weight_string('A'))
475
select hex(weight_string('abc'));
476
hex(weight_string('abc'))
478
select hex(weight_string('abc' as char(2)));
479
hex(weight_string('abc' as char(2)))
481
select hex(weight_string('abc' as char(3)));
482
hex(weight_string('abc' as char(3)))
484
select hex(weight_string('abc' as char(5)));
485
hex(weight_string('abc' as char(5)))
487
select @@collation_connection;
488
@@collation_connection
490
select hex(weight_string('a' LEVEL 1));
491
hex(weight_string('a' LEVEL 1))
493
select hex(weight_string('A' LEVEL 1));
494
hex(weight_string('A' LEVEL 1))
496
select hex(weight_string('abc' LEVEL 1));
497
hex(weight_string('abc' LEVEL 1))
499
select hex(weight_string('abc' as char(2) LEVEL 1));
500
hex(weight_string('abc' as char(2) LEVEL 1))
502
select hex(weight_string('abc' as char(3) LEVEL 1));
503
hex(weight_string('abc' as char(3) LEVEL 1))
505
select hex(weight_string('abc' as char(5) LEVEL 1));
506
hex(weight_string('abc' as char(5) LEVEL 1))
508
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
509
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
511
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
512
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
514
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
515
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
517
set @@collation_connection=latin1_general_cs;
518
select @@collation_connection;
519
@@collation_connection
521
select hex(weight_string('a'));
522
hex(weight_string('a'))
524
select hex(weight_string('A'));
525
hex(weight_string('A'))
527
select hex(weight_string('abc'));
528
hex(weight_string('abc'))
530
select hex(weight_string('abc' as char(2)));
531
hex(weight_string('abc' as char(2)))
533
select hex(weight_string('abc' as char(3)));
534
hex(weight_string('abc' as char(3)))
536
select hex(weight_string('abc' as char(5)));
537
hex(weight_string('abc' as char(5)))
539
select @@collation_connection;
540
@@collation_connection
542
select hex(weight_string('a' LEVEL 1));
543
hex(weight_string('a' LEVEL 1))
545
select hex(weight_string('A' LEVEL 1));
546
hex(weight_string('A' LEVEL 1))
548
select hex(weight_string('abc' LEVEL 1));
549
hex(weight_string('abc' LEVEL 1))
551
select hex(weight_string('abc' as char(2) LEVEL 1));
552
hex(weight_string('abc' as char(2) LEVEL 1))
554
select hex(weight_string('abc' as char(3) LEVEL 1));
555
hex(weight_string('abc' as char(3) LEVEL 1))
557
select hex(weight_string('abc' as char(5) LEVEL 1));
558
hex(weight_string('abc' as char(5) LEVEL 1))
560
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
561
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
563
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
564
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
566
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
567
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))
569
set @@collation_connection=binary;
570
select @@collation_connection;
571
@@collation_connection
573
select hex(weight_string('a'));
574
hex(weight_string('a'))
576
select hex(weight_string('A'));
577
hex(weight_string('A'))
579
select hex(weight_string('abc'));
580
hex(weight_string('abc'))
582
select hex(weight_string('abc' as char(2)));
583
hex(weight_string('abc' as char(2)))
585
select hex(weight_string('abc' as char(3)));
586
hex(weight_string('abc' as char(3)))
588
select hex(weight_string('abc' as char(5)));
589
hex(weight_string('abc' as char(5)))
591
select @@collation_connection;
592
@@collation_connection
594
select hex(weight_string('a' LEVEL 1));
595
hex(weight_string('a' LEVEL 1))
597
select hex(weight_string('A' LEVEL 1));
598
hex(weight_string('A' LEVEL 1))
600
select hex(weight_string('abc' LEVEL 1));
601
hex(weight_string('abc' LEVEL 1))
603
select hex(weight_string('abc' as char(2) LEVEL 1));
604
hex(weight_string('abc' as char(2) LEVEL 1))
606
select hex(weight_string('abc' as char(3) LEVEL 1));
607
hex(weight_string('abc' as char(3) LEVEL 1))
609
select hex(weight_string('abc' as char(5) LEVEL 1));
610
hex(weight_string('abc' as char(5) LEVEL 1))
612
select hex(weight_string('abc' as char(5) LEVEL 1 REVERSE));
613
hex(weight_string('abc' as char(5) LEVEL 1 REVERSE))
615
select hex(weight_string('abc' as char(5) LEVEL 1 DESC));
616
hex(weight_string('abc' as char(5) LEVEL 1 DESC))
618
select hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE));
619
hex(weight_string('abc' as char(5) LEVEL 1 DESC REVERSE))