How to calculate avg of some column in join?
All you really need to do is to SELECT from the gradetbl, apply the AVG aggregate function over the grade and then GROUP BY the teacherid like so:

SELECT teacherid, AVG(grade)
  FROM gradetbl
 GROUP BY teacherid;


For the results you have indicated there should be no need to use a JOIN at all. You will only need to use a JOIN when you want to fetch data associated with the teacherid:

SELECT t.name, AVG(g.grade)
  FROM gradetbl AS g
  JOIN teacher as t
    ON t.id = g.teacherid
 GROUP BY t.name;


You should view the documentation for SELECT, GROUP BY and AVG for thorough examples and explanations of common usage.