
Explanation:
The correct answer is SELECT user_id, event_timestamp, event_name, explode(items) AS item FROM events; because the explode function is used to transform each element of the array into a separate row, which is the desired outcome.
Ultimate access to all questions.
Given a table named ‘events‘ with a column ‘items‘ that contains an array of values, which SQL query would transform each item of the array into a separate row?
A
SELECT user_id, event_timestamp, event_name, ARRAY(items) AS item FROM events;
B
SELECT user_id, event_timestamp, event_name, items FROM events;
C
SELECT user_id, event_timestamp, event_name, UNNEST(items) AS item FROM events;
D
SELECT user_id, event_timestamp, event_name, explode(items) AS item FROM events;
No comments yet.