HIVE SQL:Select 行,其值在一列中包含字符串

HIVE SQL: Select rows whose values contain string in a column

我想要 select 列中值包含字符串的行。
例如,我想 select 其值包含 字符串 '123' 的所有行 'app'.
table:

app         id
123helper   xdas
323helper   fafd
2123helper  dsaa
3123helper  fafd
md5321      asdx
md5123      dsad

结果:

app         id
123helper   xdas
2123helper  dsaa
3123helper  fafd
md5123      dsad

我不熟悉 SQL 查询。
谁能帮帮我? .
提前致谢。

使用 like

尝试以下操作
select
  *
from yourTable
where app like '%123%'

输出:

| app        | id   |
| ---------- | ---- |
| 123helper  | xdas |
| 2123helper | dsaa |
| 3123helper | fafd |
| md5123     | dsad |

请使用以下查询,

select app, id from table where app like '%123%';

以下是一些附加信息,

like '123%' --> Starts with 123
like '%123' --> Ends with 123
like '%123%'--> Contains 123 anywhere in the string 

有多种方式:

喜欢:

select * from table
where app like '%123%'

喜欢:

...
where app rlike '123'

指导:

...
where instr(app, '123')>0

定位:

...
where  locate('123', app)>0

发明你自己的方式。

阅读手册:String Functions and Operators.