by a group of students. To determine the population covariance between the
average number of hours slept and the grade point average of the students we
write:
Example 5.19.4 The correlation coefficient between the grade point average
and the average number of hours slept is computed by:
select corr(g.avggrade, s.avghours)
from (select stno, avg(grade) as avggrade
from GRADES
group by stno) g,
(select stno, avg(no_hours) as avghours
from SSTUDY
group by stno) s
where g.stno = s.stno;
The answer is:
CORR(G.AVGGRADE,S.AVGHOURS)
---------------------------
.961293724