
Question:
Why isn't my query case sensitive?
Select * from MyTable where name like '%Ann%'
shows record 1 correctly:
Record1= John, Ann, Jack
but shows also record 2:
Record2: Jack, Susanne, Jim
Answer1:You could execute <a href="http://www.sqlite.org/pragma.html#pragma_case_sensitive_like" rel="nofollow">PRAGMA case_sensitive_like = on
</a>, but this would affect all LIKEs used in your program, and disable any index optimizations for prefix searches.
A better idea would be to replace LIKE with <a href="http://www.sqlite.org/lang_expr.html#like" rel="nofollow">GLOB</a>:
SELECT * FROM MyTable WHERE Name GLOB '*Ann*'
Answer2:[Copied from <a href="https://stackoverflow.com/a/15480401/11654" rel="nofollow">rbedger's answer</a>:]
You can use the UPPER keyword on your case insensitive field then upper-case your like statement
SELECT * FROM mytable
WHERE caseSensitiveField like 'test%'
AND UPPER(caseInsensitiveField) like 'G2%'
Answer3:the SQL LIKE is case-insensitive(thnks to CL ) So, on some SQL implementations you <a href="http://blog.sqlauthority.com/2007/04/30/case-sensitive-sql-query-search/" rel="nofollow">can do case Sensitive SQL query Searches</a>
check this too: <a href="https://stackoverflow.com/questions/5391069/case-insensitive-searching-in-oracle" rel="nofollow">Case insensitive searching in Oracle</a>