Create date-aggregate statistics of product sales and prices in plain SQL – Postgresql
I have the following two tables: CREATE TABLE products ( id INT, created_at DATE, sold_at DATE ); CREATE TABLE product_prices ( id INT, product_id INT, price numeric, created_at DATE ); The data model logic works as follows: When a new…