应该还有一句 WHERE语句, 类似 - WHERE student.id = score.id and student.id = '12345'.
SELECT
student.sname,AVG(score.degree)
FROM
student,score
WHERE
student.id = score.id
and student.id = '12345'
意思大概是查找ID为12345同学的平均分数.
@st_name 和 @st_avg 是变量名.
SELECT
@st_name=student.sname,@st_avg=AVG(score.degree)
FROM
student,score
WHERE
student.id = score.id
and student.id = '12345'
意思是查找ID为12345同学的平均分数, 然后将名称及分数分别赋予@st_name和@st_avg.