GROUPING + ROLLUP

select t.orig_yyyy 창단년도,
        grouping(t.orig_yyyy),
        t.team_name 팀명,
        grouping(t.team_name),
        count(*) 선수수,
        round(avg(p.height), 1) 평균키
from team t
join player p on t.team_id = p.team_id
group by rollup(t.orig_yyyy, t.team_name);

GROUPING_ID

select t.orig_yyyy 창단년도,
        grouping(t.orig_yyyy) as go,
        t.team_name 팀명,
        grouping(t.team_name) as gt,
        grouping_id(t.orig_yyyy, t.team_name) as g_id,
        count(*) 선수수,
        round(avg(p.height), 1) 평균키
from team t
join player p on t.team_id = p.team_id
group by rollup(t.orig_yyyy, t.team_name);