0
点赞
收藏
分享

微信扫一扫

SQL积累

沐之轻语 2022-03-20 阅读 91
sql
  1. 查询数学前5,语文不是前5的学生信息。

分析:学生表,先排除语文前五的人,在剩下来的人中,选择数学前5的人。(找出偏科数学的人)

create view yuwen   //语文前5单独拿出来
as
select top 5 * from socre order by 语文 desc    

select top 5 * from score 
where 准考证号 not in(select 准考证号 from yuwen)
order by 数学 desc


//备注:score表中有字段:准考证号(主键)、姓名、数学、语文、总分
举报

相关推荐

0 条评论