复习SQL
输出分数最低的小伙伴的信息:
select * from db_scores where score = (select min(score) as min_score from db_scores);
相关知识点
select min(score) as min_score from db_scores;
换一种小清新的写法
select * from db_scores order by score asc limit 1;
复习group by
select name, sum(score) as total_score from db_scores group by name having total_score >= 100;
复习case的应用
select id, name, score,
case
when (score > 120) then 'A'
when (score >= 90 and score <= 120) then 'B'
when (score < 90) then 'C'
end as evaluation
from db_scores;