当前位置:网站首页>The query that the user's test score is greater than the average score of a single subject
The query that the user's test score is greater than the average score of a single subject
2022-08-05 10:17:00 【go and be safe~】
Such a situation is often encountered in life. For example, in the grades of the whole class, we want to count the situation that each student's single subject score is above the average score of the subject in the class, and display it..
The case is as follows:
After each exam, there will be a grade sheet, as follows:
| id | job | score |
| 1 | C++ | 11001 |
| 2 | C++ | 10000 |
| 3 | C++ | 9000 |
| 4 | Java | 12000 |
| 5 | Java | 13000 |
| 6 | JS | 12000 |
| 7 | JS | 11000 |
| 8 | JS | 9999 |
| 9 | Java | 12500 |
Please write a sql statement to query the attributes of all grades whose user's score is greater than the average score of their job (job), and sort them in ascending order of id, as follows:
Incorrect spelling:
select g.id,g.job,g.score from grade g
left join
(select job,avg(score) as A from grade group by job) f
边栏推荐
- 深入理解 Istio 流量管理的超时时间设置
- 第五章:redis持久化,包括rdb和aof两种方式[通俗易懂]
- 【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
- egg框架使用(一)
- MySQL data view
- Oracle temporary table space role
- 教你本地编译运行一个IDEA插件,在IDEA里聊天、下棋、斗地主!
- 茄子科技CEO仇俊:以用户为中心,做用户真正需要的产品
- What is the function of the regular expression replaceFirst() method?
- 第九章:activit内置用户组设计与组任务分配和IdentityService接口的使用
猜你喜欢

一文道清什么是SPL

High-quality DeFi application building guide to help developers enjoy DeFi Summer

七夕浪漫约会不加班,RPA机器人帮你搞定工作

Pycharm 常用外部工具

哪位大佬有20年4月或者1月的11G GI和ojvm补丁呀,帮忙发下?

three.js debugging tool dat.gui use

项目成本控制如何帮助项目成功?

Jenkins manual (2) - software configuration

入门 Polkadot 平行链开发,看这一篇就够了

【MindSpore Easy-Diantong Robot-01】You may have seen many knowledge quiz robots, but this one is a bit different
随机推荐
正则表达式replaceAll()方法具有什么功能呢?
Pycharm 常用外部工具
The century-old Nordic luxury home appliance brand ASKO smart wine cabinet in the three-temperature area presents the Chinese Valentine’s Day, and tastes the love of the delicacy
公众号如何运维?公众号运维专业团队
项目成本控制如何帮助项目成功?
你最隐秘的性格在哪?
导火索:OAuth 2.0四种授权登录方式必读
攻防世界-PWN-new_easypwn
mysql索引
E-sports, convenience, efficiency, security, key words for OriginOS functions
MySQL之数据视图
Development common manual link sharing
PHP 操作mangoDb
What is SPL?
Introduction to SD NAND Flash!
Oracle temporary table space role
气象数据数据处理实例——matlab字符串切割匹配与R语言日期匹配(数据拼接)
Egg framework usage (2)
深入理解 Istio 流量管理的超时时间设置
Is digital transformation a business buy-in?