You can apply a case/when and group by the student and the class. If you want only a single person, just apply a where clause... or even if you want all students for a class, or a given school year... etc.
SELECT
g.studNumber,
g.subjCode,
MAX( case when g.period = 1 then g.grade else 0 end ) as 1st_period,
MAX( case when g.period = 2 then g.grade else 0 end ) as 2nd_period,
MAX( case when g.period = 3 then g.grade else 0 end ) as 3rd_period,
MAX( case when g.period = 4 then g.grade else 0 end ) as 4th_period,
AVG( g.grade ) as Ave
from
Grades g
group by
g.studNumber,
g.subjCode