In this lesson, let’s list all scalar functions from the course that deal with dates and timestamps numbers:
now() / getdate()
The MySQL or PostgreSQL function
now() is known as
getdate() in Redshift. It returns the current timestamp and could be used to write queries that calculate metrics relative to the present moment:
SELECT SUM(*) AS revenue_last_30_days FROM purchases WHERE refunded = FALSE AND created_at > now() - '30 days'::interval
DATE_PART() function is used to extract...