全角と半角を区別する
create table test ( id int PRIMARY KEY , name varchar(255) COLLATE utf8_unicode_ci, title varchar(255) ); INSERT INTO test(id, name, title) VALUES (1, 'abc', 'abc'),(2, 'ABC', 'ABC'),(3, 'ABC', 'ABC');
結果
mysql> SELECT * from test where name ='abc'; +----+-----------+-----------+ | id | name | title | +----+-----------+-----------+ | 1 | abc | abc | | 2 | ABC | ABC | | 3 | ABC | ABC | +----+-----------+-----------+ 3 rows in set (0.01 sec) mysql> SELECT * from test where title ='abc'; +----+------+-------+ | id | name | title | +----+------+-------+ | 1 | abc | abc | | 2 | ABC | ABC | +----+------+-------+ 2 rows in set (0.01 sec)