Table function utilities for cross tabulation and pivot operations
tablefunc
extension provides a set of functions for manipulating tables, including cross tabulation, pivoting, and connecting tables.
Your Nile database arrives with the tablefunc extension already enabled.
crosstab
: Creates pivot tables and cross tabulationsnormal_rand
: Generates normally distributed random numbersconnectby
: Implements hierarchical queriescrosstab
function transforms row-oriented data into a cross-tabulation format (pivot table).
normal_rand
function generates normally distributed random numbers:
connectby
function helps create hierarchical queries.
Let’s create a sample employee hierarchy and query it: