How to turn column into rows in presto?

Member

by dana , in category: Third Party Scripts , 3 days ago

How to turn column into rows in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 2 days ago

@dana 

To turn a column into rows in Presto, you can use the UNNEST function. Here is an example of how you can do this:


Assuming you have a table called 'example_table' with a column 'column_name' that you want to convert into rows:


SELECT value FROM example_table CROSS JOIN UNNEST(column_name) AS t(value);


This query will turn the values in the 'column_name' column into individual rows.


Make sure to replace 'example_table' with the actual name of your table and 'column_name' with the name of the column you want to convert into rows.