MySql | How to compute every row in same table
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