Extract TLD
This function extracts the top-level domain from a URL. This function will use the public suffix list to extract the TLD. Check the Extracting The Main Domain section for more information about the public suffix list.
D SELECT extract_tld('https://example.com.ac/path/path') AS tld;
βββββββββββ
β tld β
β varchar β
βββββββββββ€
β com.ac β
βββββββββββ
D SELECT extract_tld('a.example.com') AS tld;
βββββββββββ
β tld β
β varchar β
βββββββββββ€
β com β
βββββββββββLast updated
Was this helpful?