Skip to content
Advertisement

Tag: presto

calculating percentiles in aws athena

result of my query is being used in aws quicksight. even though quicksight offers percentileCont() which does the job for us I want to use it in the query instead of using calculated field. eventually what I want to do is create a point column where depending on a column that ranges from [a, b]. Right now I find out

Presto – pivot table

Hi I have a table like this: I want to convert it into like this: Answer For a fixed list of properties, you can do conditional aggregation: This puts the session id in the first column and 0/1 values in each column, depending on whether the given session owns the given property. To generate the exact output you showed (which

sql query for stratified sampling with dynamic sample size

Let say we have a table in this format: From this example, we see two stratas s1 and s2. What I want to do is stratified sampling and the sample size is the last column. For example, I want to randomly sample 2 instances from s1 and 1 random sample from s2. Any help is appreciated. Please keep in mind

Need an SQL query that will left join with another table, which will in turn return the latest values based on time, grouped into a single row

I need help with a SELECT SQL query that will left join with another table on id column, which will in turn return the latest values based on time, grouped into a single row? Basically, join the two tables in such a way that for each record in users table that exists in time_series table, return the latest values based

SQL Data cleaning

I have a data set where I am trying to clean data. I want to remove the ** from email-address and phone_number and have just numbers in the phone_number column. how can i do it. Answer Here is one option using string functions: This removes ‘**’ from email, and all non-digit characters from phone_number.

Advertisement