简体   繁体   中英

How can I get case sensitive from getting data in mysql? my language is php

How can I get case sensitive from getting data in mysql? my language is php hypertext preprocessor.

I would like to get the "user1" (without qoutation):

SELECT * FROM user WHERE Username = 'user1'

This is my query but I would like to get the exact username from the database in case sensitive.

MySql will, by default, perform a case-insensitive search but you can use the BINARY operator to make this case sensitive.

try:-

select * from `user` where binary `Username`='user1';

你可以这样尝试...

SELECT * FROM `user` WHERE BINARY  `Username` = 'user1' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM