Wednesday, 19 May 2021

Postgresql: Find the 'N' th occurrences in a string

 Sample Table:

create table filter_table (filter_type varchar(500));

Insert Query:

insert into filter_table (filter_type) values ('1111111 > 22222 > 3333333> 4444444> 123456789 > abcdefghi > 987654321 > zyxwvuts > 0000000 >');


Query to find the occurrences:

select substring(filter_type from '^(([^ ]* ){2})')

from filter_table

DBT - Models

Models are where your developers spend most of their time within a dbt environment. Models are primarily written as a select statement and ...