Help us understand the problem. What is going on with this article?

User ID 検索大、小文字区別方法

例:1S999  OK    1s999  NG

①
QLで変更する場合
テーブル作成時
CREATE TABLE `posts` (
    `id` INT(11) PRIMARY KEY AUTO_INCREMENT,
    `name` VARCHAR(100) BINARY,
    ...
);

②変更のケース
ALTER TABLE `posts` MODIFY `name` VARCHAR(100) BINARY;


③検索時に、フィールドにBINARY演算子を加える

これは一時的な設定です。
SELECT * FROM `posts` WHERE `user_id` = BINARY 'Hoge';    hogeなら、通らない。Hogeの大文字idのみ通る。

kanweb
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away