Postgres Pivot Tables

Postgres doesn’t have a built-in pivot table feature, but they are relatively easy to construct. Let’s say you have a table of users, and a table of events, and want to make a pivot table that shows how often each event occurred. create table users (name varchar); insert into users (‘gary’); insert into users (‘melissa’); …