Presto Tips

This is a reference of handy presto techniques that don’t (yet) warrant their own note.

Temporary tables syntax

WITH <temp_table_1_name> AS (<query>),
     <temp_table_2_name> AS (<query>)
SELECT <query using temp tables>

Truncate date to unit

date_trunc(unit, x)

Further described in https://prestodb.io/docs/current/functions/datetime.html

Notes mentioning this note