简体   繁体   English

SQL 字符串模式匹配

[英]SQL String Pattern Matching

I am trying to run a simple select query on a table to exclude all the records containing a single word on Snowflake.我正在尝试在表上运行一个简单的 select 查询,以排除在雪花上包含单个单词的所有记录。

For Eg there is a column - " NAME" having datatype - STRING - containing a single word and combination of words.例如,有一列 - “NAME”,数据类型 - STRING - 包含单个单词和单词组合。

I want to build a query to exclude all iterations of a sub-string present in that column ( uppercase,lowercase and camel-case via a single query)我想构建一个查询以排除该列中存在的子字符串的所有迭代(大写,小写和驼峰式通过单个查询)

I am trying to run a simple select query on a table to exclude all the records containing a single word我正在尝试对表运行一个简单的 select 查询以排除包含单个单词的所有记录

You could use ILIKE to perform case-insensitive comparison:您可以使用ILIKE执行不区分大小写的比较:

SELECT *
FROM tab
WHERE NAME NOT ILIKE '%phrase%';

db<>fiddle demo db<>小提琴演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM