MySQL查詢默認是不區分大小寫的 如:
select * from table_name where a like 'a%'
select * from table_name where a like 'A%'
select * from table_name where a like 'a%'
select * from table_name where a like 'A%'
效果是一樣的。
要讓MySQL查詢區分大小寫,可以:
select * from table_name where binary a like 'a%'
select * from table_name where binary a like 'A%'
select * from table_name where binary a like 'a%'
select * from table_name where binary a like 'A%'
也可以在建表時,加以標識
create table table_name(
a varchar (20) binary
)
create table table_name(
a varchar(20) binary
)