add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
4 rows affected
Coder Subject Score
Bob SQL 95
Bob Python 80
Emily SQL 98
Emily Python 90
Coder Python SQL
Bob 80 95
Emily 90 98
Subject
Python
SQL
PivotList
Python,SQL
PivotSQL

SELECT *
FROM (
SELECT [Coder]
,[Subject]
,[Score]
FROM SkillQuiz
) AS SkillQuizResults
PIVOT(SUM([Score]) FOR [Subject] IN (
Python,SQL
)) AS PivotTable
Coder Python SQL
Bob 80 95
Emily 90 98
Coder Subject Score
Bob SQL 95
Bob Python 80
Emily SQL 98
Emily Python 90
Bob Java 96
Bob Scala 86
Bob R 86
Emily Java 91
Emily Scala 91
Emily R 86
PivotSQL

SELECT *
FROM (
SELECT [Coder]
,[Subject]
,[Score]
FROM SkillQuiz
) AS SkillQuizResults
PIVOT(SUM([Score]) FOR [Subject] IN (
Java,Python,R,Scala,SQL
)) AS PivotTable
Coder Java Python R Scala SQL
Bob 96 80 86 86 95
Emily 91 90 86 91 98
PivotSQL

SELECT *
FROM (
SELECT [Coder]
,[Subject]
,[Score]
FROM SkillQuiz
) AS SkillQuizResults
PIVOT(SUM([Score]) FOR [Coder] IN (
Bob,Emily
)) AS PivotTable
Subject Bob Emily
Java 96 91
Python 80 90
R 86 86
Scala 86 91
SQL 95 98