Performance of queries * compared three techniques : * self-join view: CREATE VIEW pivot_table AS SELECT a.student AS student, b.grade AS reading, c.grade AS writing, d.grade AS arithmetic FROM (SELECT DISTINCT(student) FROM base_table) a INNER JOIN (SELECT student,grade FROM base_table WHERE subject='reading') b ON b.student=a.student INNER JOIN (SELECT student,grade FROM base_table WHERE subject='writing') c ON c.student = a.student ... * aggregate view: CREATE VIEW pivot_table AS SELECT student, GROUP_CONCAT(CASE WHEN subject='reading' THEN grade ELSE NULL END) as reading, GROUP_CONCAT(CASE WHEN subject='writing' THEN grade ELSE NULL END) as writing, ... GROUP BY student * virtual pivot table: CREATE VIRTUAL TABLE pivot_table USING perl ("SQLite::VirtualTable::Pivot", "base_table");