Aadesh Shukla
Aadesh Shukla

Reputation: 39

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.

For E.g. there is a column - " NAME" having datatype - STRING - containing a single word and combination of words.

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)

Upvotes: 0

Views: 66

Answers (1)

Lukasz Szozda
Lukasz Szozda

Reputation: 175556

I am trying to run a simple select query on a table to exclude all the records containing a single word

You could use ILIKE to perform case-insensitive comparison:

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

db<>fiddle demo

Upvotes: 1

Related Questions