Skip to content
Advertisement

Tag: pattern-matching

Postgres pattern matching middle letters of a string

How would I match a name, such that one of the middle letters of the name must come from the word ‘qwerty'(thus containing either of the letters ‘q’, ‘w’ , ‘e’, ‘r’, ‘t’,’y’)? I am curious how you can determine what the middle letters are, this would make use of some string count I assume. What I have tried so

Text to List in SQL

Is there any way on how to convert a comma separated text value to a list so that I can use it with ‘IN’ in SQL? I used PostgreSQL for this one. Ex.: This query: produces ‘SG’,’PH’ I wanted to produce this query: Nothing returned when I executed the first query. The table has been filled with location values ‘SG’

Advertisement