Skip to content
Advertisement

Tag: amazon-athena

Presto SQL save query results in variable

I have a database that I am querying with athena. I am using subqueries to select a subset of the data like so can I save the query results of in a variable VAR so that we need not query it again and again and also to make query look cleaner? Answer There is no such concept as variable in

sql – query for all values in table with limit

I have an SQL query which I run in Amazon Athena: where I order by B and take the first row only for the value 1000 for A. However I want to run this query for all values of A in T i.e for each A in T get the first row only and append to the results. How do

Count ROW type item Athena / Presto

I have an Athena query like this and the result is I would like to count the number of records per day per devices to have a result like this EDIT My dataset is actually like this Here the expected results would be : Answer You can cast your json to map and count number of keys: Output: device_id date

Advertisement