9951 explained code solutions for 126 technologies

postgresqlHow can I retrieve data from PostgreSQL for yesterday's date?

The following example code block can be used to retrieve data from PostgreSQL for yesterday's date:

FROM table_name
WHERE date_column = CURRENT_DATE - INTERVAL '1 day';

This statement will select all data from the specified table with a date value equal to yesterday's date.

The parts of the code are:

  1. SELECT * - This selects all columns from the specified table.
  2. FROM table_name - This specifies the table from which the data should be retrieved.
  3. WHERE date_column = CURRENT_DATE - INTERVAL '1 day' - This specifies the condition for selecting data from the table where the date column is equal to yesterday's date.

Helpful links

Edit this code on GitHub