当前位置:网站首页>一道很简答但是没答对的SQL题
一道很简答但是没答对的SQL题
2022-08-09 06:20:00 【Hejjon】
题干: 用一条SQL语句查询出每门课程成绩都大于80分的学生姓名.
t_score 表

解答:
第一步: 先查出所有成绩中的最小值
select name, min(score) from t_score;
这只能显示一条数据, 是所有学生中成绩最低的那一条.
第二步: 考虑到要每个学生成绩都要大于80, 重点是每个, 于是按姓名分组
select `name`, min(score) minScore from t_score group by `name`
此时的结果是

意思是 张三最低成绩是76分, 李四最低分是83分, 王五最低分是82分.
第三步: 也就是最后的过滤, 把最低分数大于80的挑选出来.
select `name`, min(score) minScore from t_score group by `name` having minScore > 80;
注意此处只能用having, 不能用 where.
边栏推荐
- 手把手教你用C语言制作七夕流星雨---优雅永不过时(详细教程)
- 5年测试开发工程师感悟——写给还在迷茫中的朋友
- Introduction of convenient functions and convenient shortcut keys of vs tomato assistant
- Xilinx Zynq ZynqMP DNA
- 中英文说明书丨CalBioreagents 醛固酮单克隆抗体
- Chapter 3 Search and Graph Theory (1)
- 契约测试(上):什么是契约测试
- 具有CT造影功能的硫化铋纳米棒|硫化铋-锌原卟啉复合材料(PAMAM/Bi2S3复合纳米粒子)
- 获取开发版安全码SHA1时遇到的报错
- pytorch implements GAN entry case
猜你喜欢

手把手教你用C语言制作七夕流星雨---优雅永不过时(详细教程)

中英文说明书丨CalBioreagents 醛固酮单克隆抗体

Unity C# 委托——事件,Action,Func的作用和区别

A test engineer with an annual salary of 35W was laid off. Personal experience: advice that you have to listen to

A day to learn a public company: Sophia

How to automatically fill down an excel table without dragging the mouse down

深度学习-神经网络原理2

运算放大器(OPA)超详细参数讲解-运放---以及8个型号的运算放大器分析对比

Introduction to AIOT

Fe3O4/SiO2 Composite Magnetic Nanoparticles Aminated on SiO2-NH2/Fe3O4 Surface (Qiyue Reagent)
随机推荐
IQ Products巨细胞病毒CMV感染检测试剂盒的特征和应用
GNNExplainer应用于节点分类任务
The difference between LDO and DC-DC
kubernetes apparmor 简介
How to automatically fill down an excel table without dragging the mouse down
The 24th day of the special assault version of the sword offer
聚酰胺-胺(PAMAM)树形聚合物-硫化铋复合纳米粒子|硫化铋修饰Gd‑DTPA‑OA配体|科研实验用
22年下高项论文题目预测
SiO2 / KH550 modified ferroferric oxide nano magnetic particles | PDA package the ferromagnetic oxide nanoparticles (research)
tidb 宕机测试
VScode安装了ESlint以后不管用、不生效的解决办法
金仓数据库能否设置事务自动提交
el-table缓存数据
qt发送邮件程序
Domain name batch query online tool
【Feel】In the Unity Feel plugin, Camera cannot display CameraShake correctly
Remember a nest.js route that matches all the path problems that follow
【Wwise】ArgumentException: The specified path is not of a legal form (empty).关于WwiseGlobal中的路径读取错误问题
Harbor Enterprise Mirror Warehouse Construction
se2clam