Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hive query string case

Is there a way to get all the types of string cases while doing this:

select count(word) from table where word="abcd"

Actually when doing this, it is not the same as this:

select count(word) from table where word="ABCD"
like image 557
Xorsist Avatar asked Feb 25 '14 13:02

Xorsist


1 Answers

Ignoring the case in a where clause is very simple. You can, for example, convert both sides of the comparison to all caps notation:

SELECT COUNT(word) 
FROM   table 
WHERE  UPPER(word)=UPPER('ABCD')

Regardless of the capitalization used for the search term , the UPPER function makes them match as desired.

like image 71
Sarah Avatar answered Oct 22 '22 23:10

Sarah