How would I go about extracting a specific part of the path using PARSE_URL? For example, if I query...
> WITH cte AS (
> SELECT CONCAT('http://', COLUMN1) AS URL FROM VALUES
> ('www.url1.com/test'),
> ('www.url1.com/test2/'),
> ('www.url1.com/test/sub_test/') )
> SELECT URL,
> PARSE_URL(URL) AS parts,
> PARSE_URL(URL):path::text AS path,
> TRIM(PARSE_URL(URL):path::text, '/') AS path
> FROM cte;
For www.url1.com/test/sub_test, the path is test/sub_test, but how would I extract just sub_test?
Use
SELECT RIGHTfor it, man. Just you have to find last "/" position