Postgresql – Efficient way to return counts and averages without joining together multiple CTEs
In my PostgreSQL 14.8 database I have a table named orders that looks as follows: CREATE TABLE orders ( user_id int , order_id int , order_date date , quantity int , revenue float , product text ); INSERT INTO orders…