Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using like operator to check for pattern in hive

I need to retrieve the columns from a hive table that must begin with uppercase letter and end with digit. I used this query

select * from tab1 where col1 like '[A-Z]%[0-9]';

But not able to retrieve the records ,getting only empty result.

like image 547
Pragadeesh Avatar asked Mar 15 '17 12:03

Pragadeesh


1 Answers

rlike / regexp

select * from tab1 where col1 rlike '^[A-Z].*[0-9]$';
like image 52
David דודו Markovitz Avatar answered Oct 19 '22 23:10

David דודו Markovitz