Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trino or presto cast '["b", "a", "b", "c"]' into a values array

Tags:

sql

presto

trino

is there a good way to cast a json type of array '["b", "a", "b", "c"]' into an array.

e.g. something that looks like this

select array['b', 'a', 'c', 'b'];
like image 369
user10765213 Avatar asked Jan 24 '26 15:01

user10765213


1 Answers

I found it in the documentation:

select CAST(JSON '["b", "a", "b", "c"]' AS ARRAY(varchar));
like image 113
user10765213 Avatar answered Jan 26 '26 08:01

user10765213



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!