BigQuery UNNEST vector with custom column names?

Viewed 66

I have this code that runs fine in the BigQuery editor,

SELECT * FROM UNNEST([(1,2),(3,4)])

However, how can i give those outputs custom column names such as x and y, instead of the default f0_ and f1_

SELECT x,y FROM UNNEST([(1,2),(3,4)])
1 Answers

SELECT x,y FROM UNNEST(ARRAY<STRUCT<x INT64, y INT64>>[(1,2),(3,4)])

Related