MySql | How to compute every row in same table I have this table

Grade   Lec    Lab
1.50       3      0
1.50       3      0
1.50       2      1


The formula will be

1.50 * 3
1.50 * 3
1.50 * (2 + 1) = 13.5

The results will divide to total number of lec and lab it will be 13.5 / 9 = 1.5
So you want to get the total sum of grades, lec and lab and divide that by the total sum of lec and lab?

SELECT (SUM(Grade) + SUM(Lec) + SUM(Lab)) /  (SUM(Lec) + SUM(Lab))
FROM grades;


Result: 

1.6667


Db&lt;>fiddle