Skip to content
Advertisement

Tag: presto

sql; concatenate MIN(price) and MAX(price) into column?

I am working on an aws athena query like so: Which will give results like so: Right now I have maxprice and minprice as two separate columns, but I want to combine them into one column “price range” which will have minprice and maxprice separated by a ” – ” string, so it would look something like this: I tried

Presto equivalent of CONCAT_WS

I’m looking for a function in Presto to concat two columns with a separator like underline. Answer Your are looking here for the array_join function, see docs. array_join(x, delimiter, null_replacement) → varchar Concatenates the elements of the given array using the delimiter and an optional string to replace nulls. Example: columns are c1,c2 you can add more of course: Results

Is there a way to group by part of a datetime column in SQL?

I have a dataframe something like this. is there a way to return a table that sums the dollar values based on the time down to the minute. For example: Notice that the “time” data in the original data set spans over a few days but I am only concerned with the time of day. Thanks Answer I’m not sure

What is cardinality() in presto sql?

Does anyone know the purpose of cardinality() function in sql? How does it work with unnest function? SELECT story_id, cardinality(image_tags) AS image_tags, cardinality(comment_tags) as …

Generate list of all dates between x & y

I am tyring to use a solution I found online to generate a table of all dates between yesterday and Jan 1st of the prior year. SELECT CAST(date_column AS DATE) AS DAY FROM ( VALUES (SEQUENCE(…

Advertisement