select
exam_date,
MAX(CASE WHEN subject = '语文' THEN score ELSE NULL END) AS chinese_score,
MAX(CASE WHEN subject = '数学' THEN score ELSE NULL END) AS math_score,
MAX(CASE WHEN subject = '英语' THEN score ELSE NULL END) AS english_score
from
scores
where
student_id = '460093'
group by
exam_date
SELECT student_id, SUM(score) AS total_score
FROM scores
WHERE subject IN ('语文', '数学', '英语') AND exam_date = '2024-06-30'
GROUP BY student_id
HAVING SUM(score) > 330;
select
case when enter_date < '2000-01-01' then '资深教师'
when enter_date >= '2010-01-01' then '青年教师'
else '中年教师'
end as teacher_type,
count(*) as teacher_count
from
teachers
group by
teacher_type
select
student_id,
max(score) as max_score,
min(score) as min_score,
avg(score) as avg_score
from
scores
where
(student_id = '460093 ' or student_id = '735011 ')
and
subject = '数学'
group by
student_id
select
name,
subject,
class_code,
qualification
from
teachers
where
(fir_degr= '清华大学' orfir_degr = '北京大学')
and
head_teacher is not null
order by
name asc