Run the code and you’ll learn!
I’ll paste lots of screenshots here, since this part is mostly about practical operation!
IN MY POINT OF VIEW, you should know:
By using other language (like PL/pgSQL), we can access SQL
Functions and Procedures can be defined in SQL database
Using external language to operate database can increase efficiency, but may cause security issues, which can be solved by sandbox and running in a separate process.
Triggers can be utilized to automatically do some tasks, e.g. update.
Ranking & Windowing are powerful stuffs
About OLAP:
OLAP is an advanced technique to do analytical, interactive tasks, especially useful for multi-dimensional data