BigQuery How to extract domain from URL

If you want extract a domain from provided URL strings in BigQuery.

It’s very easy. You can use net.Host function.

WITH
  examples AS (
  SELECT "https://some.domain.com/path?query=param#hash" AS example
  UNION ALL
  SELECT "some.domain.com/path?query=param#hash" AS example)
SELECT
  NET.HOST(example)
FROM
  examples

답글 남기기