I don't understand. The pivoted table is only done visually, the underlying data is not transposed. If you need something like that, then you should do that in SQL, if you need to results to be changed.
What I meant to ask was, what way to do the same in PSQL?
The query I am currently using is:
SELECT "public"."quizlodata"."studentid" AS "studentid", "public"."quizlodata"."lo" AS "lo", avg("public"."quizlodata"."score") AS "avg"
FROM "public"."quizlodata"
GROUP BY "public"."quizlodata"."studentid", "public"."quizlodata"."lo"
ORDER BY "public"."quizlodata"."studentid" ASC, "public"."quizlodata"."lo" ASC
My requirement is to have "studentid" as column 1 for each row, pivot the table using "lo" and have "avg" as the values in the cells.