2

In mySQL I have to use WHERE BINARY UPPER(col1) = col1 but in Oracle it works with no problem. Can someone explain to me why this is? I am new to mySQL.

So looking at it with the following statement

select upper(col1),col1
from mytable
where upper(col1) = col1;

Result in Oracle:

UPPER(COL1)          COL1               
-------------------- --------------------
JÜRGEN               JÜRGEN               
RENÉ                 RENÉ                 
CARL                 CARL 

Result in MySQL

UPPER(COL1)          COL1               
-------------------- --------------------
JÜRGEN               JÜRGEN               
JÜRGEN               Jürgen               
RENÉ                 René                 
RENÉ                 RENÉ                 
CARL                 Carl                 
CARL                 CARL 
hol
  • 8,255
  • 5
  • 33
  • 59

3 Answers3

3

Your MySQL collation is case-insensitive... so 'CARL' = 'Carl' is true.

EthanB
  • 4,239
  • 1
  • 28
  • 46
1

Place the word BINARY between your WHERE and UPPER. That will force a case sensitive comparison

Tim
  • 11
  • 1