I'm trying to use SQL to create a table with a reduced number of columns and an increased number of rows, from a table with many columns, by putting all columns in one column and all cells in another column.
My table:
Person | Hobbies | School | Jobs |
---|---|---|---|
Mark | Tennis | University | Doctor |
Dave | Chess | Highschool | Chef |
Tim | Travel | University | Sales |
Desired output:
Person | Column | Value |
---|---|---|
Mark | Hobbies | Tennis |
Mark | School | University |
Mark | Jobs | Doctor |
Dave | Hobbies | Chess |
Dave | School | Highschool |
Dave | Jobs | Chef |
Tim | Hobbies | Travel |
Tim | School | University |
Tim | Jobs | Sales |
How can this be done?
Thanks!