Using like operator to check for pattern in hive

↘锁芯ラ 提交于 2021-01-22 10:15:06

问题


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.


回答1:


rlike / regexp

select * from tab1 where col1 rlike '^[A-Z].*[0-9]$';


来源:https://stackoverflow.com/questions/42809183/using-like-operator-to-check-for-pattern-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!