当前位置:网站首页>一道很简答但是没答对的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.
边栏推荐
- Gao Zelong, a famous digital collection expert and founder of the Digital Collection Conference, was interviewed by China Entrepreneur Magazine
- RNN-T
- 获取开发版安全码SHA1时遇到的报错
- tidb crash test
- Superparamagnetic iron [email protected]@cadmium sulfide nanocore-shell structure material|Fe3O4 magnetic nanop
- Chapter 7. Image-based lighting
- phpstudy install flarum forum
- 磁性核壳四氧化三铁颗粒负载金纳米星|磁性Fe3O4-POSS-COOH|超顺磁四氧化三铁聚多巴胺核壳结构纳米粒子
- Word文件的只读模式没有密码怎么退出?
- GNNExplainer applied to node classification task
猜你喜欢
Fe3O4/SiO2 Composite Magnetic Nanoparticles Aminated on SiO2-NH2/Fe3O4 Surface (Qiyue Reagent)
AIOT介绍
运放-运算放大器经典应用电路大全-应用电路大全
一文搞懂│XSS攻击、SQL注入、CSRF攻击、DDOS攻击、DNS劫持
Used to import the data type
Bismuth sulfide nanorods with CT imaging function | Bismuth sulfide-zinc protoporphyrin composites (PAMAM/Bi2S3 composite nanoparticles)
【Feel】Unity Feel插件中,Camera无法正确显示CameraShake
关于如何查找NXP S32K1xx系列单片机的封装信息和引脚定义
Xray - powerful vulnerability scanning tools
【JMeter】jmeter测试 - 上传多个图片/批量上传图片接口 CSV文件参数化方法
随机推荐
51 serial communication (on)
list 字符串的输出方法 print(*a) print(““.join(str(c) for c in a) )
phpstudy 安装 flarum论坛
【微信小程序】5分钟实现微信小程序海报
数据中台项目前期总结
Getting Started with MATLAB Image Processing
shell function
Unity C# 委托——事件,Action,Func的作用和区别
磁性核壳四氧化三铁颗粒负载金纳米星|磁性Fe3O4-POSS-COOH|超顺磁四氧化三铁聚多巴胺核壳结构纳米粒子
harbor企业级镜像仓库搭建
mongo+ycsb性能测试及线程数分析
After the VB.net program is closed, the background is still connected to SQL
Domain name batch query online tool
力扣刷题180
ZIP压缩包文件删除密码的方法
正则表达式-判断字符串是否匹配“AABB”模式
VB.net程序关闭后后台还在与SQL连接
Introduction of convenient functions and convenient shortcut keys of vs tomato assistant
直接用的zip包 缺少很多依赖,pip没有,感觉用anaconda create一个环境会方便点
直播平台怎么搭建,设置状态栏颜色、沉浸式状态栏