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:

  1. By using other language (like PL/pgSQL), we can access SQL
  2. Functions and Procedures can be defined in SQL database
  3. 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.
  4. Triggers can be utilized to automatically do some tasks, e.g. update.
  5. Ranking & Windowing are powerful stuffs
  6. About OLAP:

Intro: Accessing SQL From A Programming Language

Functions & Procedures

Language Constructs for Functions & Procedures

External Language Routines

Trigger

Recursion

Ranking

Windowing

OLAP (Online Analytical Processing)