How to turn column into rows in presto?

Member

by dana , in category: Third Party Scripts , 4 months ago

How to turn column into rows in presto?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by ryan.murray , 4 months 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.

Related Threads:

How to group time column into 5 second intervals and count rows using presto?
How to fetch an unlimited number of rows in presto?
How to get date_diff from previous rows in presto?
How to update all rows in a column in codeigniter?
How to attach dynamic value to multiple rows in presto?
How to add values in single column of multiple rows in postgresql