使用 like 运算符检查配置单元中的模式 [英] Using like operator to check for pattern in hive

查看:33
本文介绍了使用 like 运算符检查配置单元中的模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从 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.

推荐答案

rlike/regexp

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

这篇关于使用 like 运算符检查配置单元中的模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆