VeloDB Cloud
SQL Manual
SQL Functions
String Functions
TOP_LEVEL_DOMAIN

Description

Syntax

VARCHAR top_level_domain(VARCHAR url)

Extract the top-level domain from a URL and return it. If the URL is invalid, return an empty string.

Example

mysql [(none)]>select top_level_domain("www.baidu.com");
+-----------------------------------+
| top_level_domain('www.baidu.com') |
+-----------------------------------+
| com                               |
+-----------------------------------+
 
mysql [(none)]>select top_level_domain("www.google.com.cn");
+---------------------------------------+
| top_level_domain('www.google.com.cn') |
+---------------------------------------+
| cn                                    |
+---------------------------------------+
 
mysql [(none)]>select top_level_domain("wwwwwwww");
+------------------------------+
| top_level_domain('wwwwwwww') |
+------------------------------+
|                              |
+------------------------------+

keywords

top_level_domain