PostgreSQL Database
- a PostgreSQL server instance manage a database cluster
- a database cluster consists of a collection of database
- tables are grouped into a database.
- each table is a named collection of rows
- each row of a table has a fixed order of named columns
- each column is of a specific data type
Window Function
SELECT user, department, salary,
avg(salary) OVER (PARTITION BY department)
FROM empsalary;
PL/Tcl
Use Tcl language to write PostgreSQL functions and procedures.
Tcl code is executed in a safe Tcl interpreter.
CREATE FUNCTION
tcl_max (integer, interger) RETURNS integer
AS $$
if {$1 > $2} { return $1}
return $2
$$ LANGUAGE pltcl
Table Joins
- INNER JOIN
- LEFT OUTER JOIN
- RIGHT OUTER JOIN
- FULL Outer JOIN