By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
2 rows affected
Coder | SQL | Python |
---|---|---|
Bob | 95 | 80 |
Emily | 98 | 70 |
Coder | Subject | Score |
---|---|---|
Bob | SQL | 95 |
Bob | Python | 80 |
Emily | SQL | 98 |
Emily | Python | 70 |
Unpivot_List |
---|
[Python],[SQL] |
UnPivotSQL |
---|
SELECT Coder ,Subject ,Score FROM SkillQuiz UNPIVOT(Score FOR Subject IN ( [Python],[SQL] )) AS Unpivoted_Table ORDER BY Coder ,Score DESC |
Coder | Subject | Score |
---|---|---|
Bob | SQL | 95 |
Bob | Python | 80 |
Emily | SQL | 98 |
Emily | Python | 70 |
2 rows affected
Coder | SQL | Python | Java |
---|---|---|---|
Bob | 95 | 80 | null |
Emily | 98 | 70 | null |
Ryan | 95 | 90 | 70 |
Josh | 60 | 77 | 100 |
UnPivotSQL |
---|
SELECT Coder ,Subject ,Score FROM SkillQuiz UNPIVOT(Score FOR Subject IN ( [Java],[Python],[SQL] )) AS Unpivoted_Table ORDER BY Coder ,Score DESC |
Coder | Subject | Score |
---|---|---|
Bob | SQL | 95 |
Bob | Python | 80 |
Emily | SQL | 98 |
Emily | Python | 70 |
Josh | Java | 100 |
Josh | Python | 77 |
Josh | SQL | 60 |
Ryan | SQL | 95 |
Ryan | Python | 90 |
Ryan | Java | 70 |