Hi. I am a beginner in the domain of databases. I learn a Postgresql encountered the practice in the field of aggregate functions, with which I do not know how to solve. Namely, I have a simplified structure of a table:
The database is a simple database to store CDs.
Exercise is: the receipt of the quarter (season), the total value of orders placed by customers in 2004 was the lowest. Only I could write just the same thing:
SELECT EXTRACT(QUARTER FROM orderdate) AS "Quarter" FROM orders o
WHERE EXTRACT(YEAR FROM orderdate)=2004
GROUP BY EXTRACT(QUARTER FROM orderdate)
HAVING SUM(totalamount) < ...
and I do not know how to finish the query.
Please help with writing a how to complete the choice of the quarter (season), the total value of orders placed by customers was the lowest.
Thanks for help.