当前位置:网站首页>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
边栏推荐
- 为什么sys_class 里显示的很多表的 RELTABLESPACE 值为 0 ?
- 入门 Polkadot 平行链开发,看这一篇就够了
- FPGA:基础入门按键控制LED灯
- 一个栈的输入序列为1 2 3 4 5 的出站顺序的理解
- 告白数字化转型时代:麦聪软件以最简单的方式让企业把数据用起来
- three物体围绕一周呈球形排列
- 七夕浪漫约会不加班,RPA机器人帮你搞定工作
- EU | Horizon 2020 ENSEMBLE: D2.13 SOTIF Safety Concept (Part 2)
- 我们的Web3创业项目,黄了
- SMB + SMB2: Accessing shares return an error after prolonged idle period
猜你喜欢
随机推荐
dotnet OpenXML parsing PPT charts Getting started with area charts
Tanabata romantic date without overtime, RPA robot helps you get the job done
气象数据数据处理实例——matlab字符串切割匹配与R语言日期匹配(数据拼接)
【AGC】增长服务1-远程配置示例
第七章,activiti个人任务分配,动态指定和监听器指定任务委派人「建议收藏」
Why are RELTABLESPACE values 0 for many tables displayed in sys_class?
Qiu Jun, CEO of Eggplant Technology: Focus on users and make products that users really need
开发常用手册链接分享
Open Source Summer | How OpenHarmony Query Device Type (eTS)
uniapp 连接ibeacon
MySQL advanced (twenty-seven) database index principle
什么是CRM决策分析管理?
What is the function of the regular expression replaceAll() method?
IO stream articles -- based on io stream to realize folder copy (copy subfolders and files in subfolders) full of dry goods
What is SPL?
电竞、便捷、高效、安全,盘点OriginOS功能的关键词
还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!
Four years of weight loss record
5.部署web项目到云服务器
Microservice Technology Stack