The column data is displayed horizontally:
CREATE TABLE studenscore (stuname varchar), KC varchar (+), FS INT)
INSERT into Studenscore VALUES (' Zhang San ', ' language ', 74);
INSERT into Studenscore VALUES (' Zhang San ', ' math ', 83);
INSERT into Studenscore VALUES (' Zhang San ', ' physical ', 93);
INSERT into Studenscore VALUES (' John Doe ', ' language ', 74);
INSERT into Studenscore VALUES (' John Doe ', ' math ', 84);
INSERT into Studenscore VALUES (' John Doe ', ' physics ', 94)
SELECT * from Studenscore
SELECT Stuname as name,
MAX (case KC when ' language ' then fs ELSE 0 END) language,
MAX (case KC when ' math ' then fs ELSE 0 END) Math,
MAX (case KC when ' physical ' then fs ELSE 0 END) physical
From Studenscore
GROUP by Stuname;
SELECT Stuname as name,
SUM (case KC when ' language ' then fs ELSE 0 END) language,
SUM (case KC when ' math ' then fs ELSE 0 END) Math,
SUM (case KC when ' physical ' then fs ELSE 0 END) physical
From Studenscore
GROUP by Stuname;
As for Max and Sum, there is no difference between the two, you can investigate the data
The SQL data column is displayed horizontally