Created
March 3, 2017 23:31
-
-
Save akirattii/b7d854ba02170b49743eef4ccdc43e57 to your computer and use it in GitHub Desktop.
MySQLで大文字と小文字を区別して検索する方法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- MySQL | |
| -- 大文字と小文字を区別しない検索: | |
| select * from mytable where name like 'a'; -- <= "a", "A" どちらにもヒットする | |
| -- 大文字と小文字を区別する検索: | |
| select * from mytable where name like BINARY 'A'; -- <= likeの後に `BINARY` をつけることで "A" にだけヒットする |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment