Ratio per Group in PostgreSQL
Nevermind, found it myself :3

WITH merged_stat (lec, maj, cla, cou) AS (
    values 
      ('lec1', 'major1', 'class1', 10.0),
      ('lec1', 'major2', 'class1', 40),
      ('lec1', 'major1', 'class2', 30),
      ('lec1', 'major3', 'class3', 35),
      ('lec2', 'major1', 'class3', 15),
      ('lec2', 'major3', 'class3', 10)
)
SELECT lec
    , maj
    , cou/SUM(cou) OVER (PARTITION BY lec, cla)
FROM merged_stat
;


result:

 lec  |  maj   |        ?column?        
------+--------+------------------------
 lec1 | major1 | 0.20000000000000000000
 lec1 | major2 | 0.80000000000000000000
 lec1 | major1 | 1.00000000000000000000
 lec1 | major3 | 1.00000000000000000000
 lec2 | major1 | 0.60000000000000000000
 lec2 | major3 | 0.40000000000000000000