How to get yesterday’s date in Redshift database

Use the getdate function to get today’s date. Add or Subtract days as required from today’s date.

Example, to get yesterday’s date, you can subtract 1 from today’s date as below:

select trunc(getdate())-1;

Syntax to query all employees hired in the last 30 days:

SELECT employee_name from employee where hire_date > trunc(getdate())-30;

See also  How to list all the IAM groups of your AWS account