VeloDB Cloud
SQL Manual
SQL Functions
String Functions
CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN

Description

Syntax

VARCHAR cut_to_first_significant_subdomain(VARCHAR url)

Extract the part of the domain in the URL from the top-level subdomain down to the "first valid subdomain." If invalid, return an empty string.

Examples

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

Keywords

CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN