A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/bigquery/docs/reference/standard-sql/utility-functions below:

Utility functions | BigQuery | Google Cloud

Utility functions

Stay organized with collections Save and categorize content based on your preferences.

GoogleSQL for BigQuery supports the following utility functions.

Function list Name Summary GENERATE_UUID Produces a random universally unique identifier (UUID) as a STRING value. TYPEOF Gets the name of the data type for an expression. GENERATE_UUID
GENERATE_UUID()

Description

Returns a random universally unique identifier (UUID) as a STRING. The returned STRING consists of 32 hexadecimal digits in five groups separated by hyphens in the form 8-4-4-4-12. The hexadecimal digits represent 122 random bits and 6 fixed bits, in compliance with RFC 4122 section 4.4. The returned STRING is lowercase.

Return Data Type

STRING

Example

The following query generates a random UUID.

SELECT GENERATE_UUID() AS uuid;

/*--------------------------------------*
 | uuid                                 |
 +--------------------------------------+
 | 4192bff0-e1e0-43ce-a4db-912808c32493 |
 *--------------------------------------*/
TYPEOF
TYPEOF(expression)

Description

Takes an expression and gets the name of the data type for that expression.

Return type

STRING

Examples

The following example produces the name of the data type for the expression passed into the TYPEOF function. When NULL is passed in, the supertype, INT64, is produced.

SELECT
  TYPEOF(NULL) AS A,
  TYPEOF('hello') AS B,
  TYPEOF(12+1) AS C,
  TYPEOF(4.7) AS D

/*-------+--------+-------+--------*
 | A     | B      | C     | D      |
 +-------+--------+-------+--------+
 | INT64 | STRING | INT64 | FLOAT64 |
 *-------+--------+-------+--------*/

The following example produces the name of the data type for field y in a struct.

SELECT
  TYPEOF(STRUCT<x INT64, y STRING>(25, 'apples')) AS struct_type,
  TYPEOF(STRUCT<x INT64, y STRING>(25, 'apples').y) AS field_type;

/*---------------------------+------------*
 | struct_type               | field_type |
 +---------------------------+------------+
 | STRUCT<x INT64, y STRING> | STRING     |
 *---------------------------+------------*/

The following example produces the name of the data type for elements in an array.

SELECT
  TYPEOF(ARRAY<INT64>[25, 32]) AS array_type,
  TYPEOF(ARRAY<INT64>[25, 32][0]) AS element_type;

/*--------------+--------------*
 | array_type   | element_type |
 +--------------+--------------+
 | ARRAY<INT64> | INT64        |
 *--------------+--------------*/

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["GoogleSQL for BigQuery offers utility functions, including one for generating UUIDs."],["The `GENERATE_UUID` function creates a random universally unique identifier (UUID)."],["The UUID is returned as a `STRING` with 32 hexadecimal digits in a specific format, following RFC 4122 standards."],["The output of `GENERATE_UUID` will always be lowercase."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4