Extract Host
SELECT url_extract_host('https://example-subdomain.example-host.com/path/to/detail?order=desc&page=10')
-- example-subdomain.example-host.com
Extract Parameter
SELECT url_extract_parameter('https://example-subdomain.example-host.com/path/to/detail?order=desc&page=10', 'page')
-- 10
Extract Path
SELECT url_extract_path('https://example-subdomain.example-host.com/path/to/detail?order=desc&page=10')
-- /path/to/detail
Extract Port
SELECT url_extract_port('https://example-subdomain.example-host.com:8088/path/to/detail?order=desc&page=10')
-- 8088
Extract Protocol
SELECT url_extract_protocol('https://example-subdomain.example-host.com:8088/path/to/detail?order=desc&page=10')
-- https
Extract Query
SELECT url_extract_query('https://example-subdomain.example-host.com:8088/path/to/detail?order=desc&page=10')
-- order=desc&page=10
Extract Fragment
SELECT url_extract_fragment('https://example-subdomain.example-host.com:8088/path/to/detail?order=desc&page=10#header1')
-- header1
Top comments (2)
When this will be useful and where we can use this codes @dendihandian
If you have AWS account, you can try it on Athena. I'm still looking for presto sql playground to be tried for these queries...