SQLite::VirtualTable::Pivot * base_table student subject grade ------- ---------- ----- Fred reading A Fred writing B Fred arithmetic C Mary reading B Mary writing B Mary arithmetic C CREATE VIRTUAL TABLE pivot_table USING perl ("SQLite::VirtualTable::Pivot","base_table"); * pivot_table student reading writing arithmetic ------- ------- ------- ------- Fred A B C Mary B B C /* By default three columns are pivot_row, pivot_column, pivot_value */ /* Distinct values calculated per database session (creation/first use) */ /* Can handle joins transparently */ /* Better performance for small results sets */