This question already has an answer here:
I need to unpivot a table in PostgreSQL. The first dataset is what I have, the second is what I want:
Below is my schema with sample dataset:
My understanding is that you may have to use JSON functions to accomplish this in PostgreSQL, as it doesn't have an
unpivot function as some other SQL variants do. I'm open to other solutions, though.