Prepare Data:
Create table 'test _ idx '(
'I' int (10) NOT NULL,
'S 'varchar (10) not null,
KEY 'I' ('I '),
KEY's '('s ')
) ENGINE = InnoDB default charset = utf8;
Insert into test_idx (I, s) values (1, '1'), (2, '2'), (3, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9 ');
Test 1:
Explain select * from test_idx where I = 1;
Explain select * from test_idx where I = '1 ';
Result:
Numeric index. Indexes can still be used with quotation marks.
Test 2:
Explain select * from test_idx where s = 1;
Explain select * from test_idx where s = '1 ';
Result:
String index without quotation marks. The index is invalid.
Test 3:
Explain select * from test_idx where I in (1, 2 );
Explain select * from test_idx where I in (1, '2 ');
Result:
The compound query index is invalid in the numeric index.
Test 4:
Explain select * from test_idx where s in ('1', '2 ');
Explain select * from test_idx where s in (1, '2 ');
Result:
The compound query index is invalid in the string index.