mszep
mszep

Reputation: 420

SQL function in presto CROSS JOIN statement

Trying to understand the presto CROSS JOIN and UNNEST statements from the docs here, there is a code snippet that I don't understand:

SELECT student, score
FROM tests
CROSS JOIN UNNEST(scores) AS t (score);

I don't understand the lowercase t -- is it a function? What does it do? In my own tables, the query stops working when I remove the t and the parentheses, but I can't understand why.

Upvotes: 0

Views: 782

Answers (1)

Δ O
Δ O

Reputation: 3710

t is an alias, not a function. UNNEST(scores) AS t provides a virtual table, aliased t.

Upvotes: 1

Related Questions