-1

is where clause not case-sensitive??

i tried using different versions of query for the table data:

username(TEXT)    pass(TEXT)

admin                admin

The above table has only one entry

SELECT pass FROM lbdb_user WHERE username = "Admin";

SELECT pass FROM lbdb_user WHERE username = "admiN";

SELECT pass FROM lbdb_user WHERE username = "admin   ";

all the above queries that i ran produced the same result.

ldz
  • 2,217
  • 16
  • 21
parichay07
  • 45
  • 5
  • 1
    Possible duplicate of [How can I make SQL case sensitive string comparison on MySQL?](https://stackoverflow.com/questions/5629111/how-can-i-make-sql-case-sensitive-string-comparison-on-mysql) – user247702 May 06 '19 at 13:29

1 Answers1

0

Mysql collate, searching case sensitive

Usually our mysql queries are not case sensitive. In order to query case sensitive, you can use the mysql COLLATE clause. The collate clause lets you specify a collation, which basically is a set of rules for comparing characters in a given character set.

The suffixes ci, cs, bin of a collation stand for case insensitive, case sensitive and binary, respectively. A binary collation such as utf8_bin is case sensitive as well since it compares the characters based on their numeric values.

SELECT * FROM users WHERE name like 'cRaZy' COLLATE utf8_bin;
Vignesh Kumar A
  • 27,863
  • 13
  • 63
  • 115