Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save akirattii/b7d854ba02170b49743eef4ccdc43e57 to your computer and use it in GitHub Desktop.
Save akirattii/b7d854ba02170b49743eef4ccdc43e57 to your computer and use it in GitHub Desktop.
MySQLで大文字と小文字を区別して検索する方法
-- 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