当前位置:网站首页>MySQL实践总结-
MySQL实践总结-
2022-08-01 04:39:00 【LXMXHJ】
文章目录
案例1:
已知信息
员工表 Employee
| 名称 | 类型 | 描述 |
|---|---|---|
| EmployeeId | Int | 员工id(唯一) |
| Name | Varchar(50) | 员工姓名 |
| Age | Int | 员工年龄 |
| Varchar(50) | 员工邮箱 | |
| Level | Int | 员工能级 |
工资表 salary
| 名称 | 类型 | 描述 |
|---|---|---|
| SalaryId | Int | 工资id(唯一) |
| EmployeeId | Int | 员工id |
| Money | Double | 工资金额 |
| Date | Datetime | 发放日期 |
题目及解答
查询偶有员工的姓名和邮箱,并按照年龄降序、姓名升序排序。
select Name,Email
from Employee
order by Age asc,Name desc;
查询员工级别为1的所有员工的姓名及其对应的工资金额总和。
①select e.Name,s.Money
from Employee e
inner join Salary s
on e.EmployeeId = s.EmployeeId
where e.Level = 1
查询所有高于平均工资的工资发放信息以及对应的员工信息(发放日期、工资金额、员工id,员工姓名、员工年龄、员工邮箱、员工级别)
select s.Date,s.Money,s.EmployeeId,e.Name,e,Age,e.Email,e.Level
from Employee e
inner join Salary s
on e.EmployeeId = s.EmployeeId
where s.Money >(
select avg(Money)
from Salary
);
边栏推荐
- 【愚公系列】2022年07月 .NET架构班 085-微服务专题 Abp vNext微服务网关
- Advice given by experts with four years of development experience in Flutter tutorial
- 【kali-信息收集】枚举——DNS枚举:DNSenum、fierce
- 产品经理访谈 | 第五代验证码的创新与背景
- PMP子过程定义总结
- 雪糕和轮胎
- 出现Command ‘vim‘ is available in the following places,vim: command not found等解决方法
- MySQL4
- Passive anti-islanding-UVP/OVP and UFP/OFP passive anti-islanding model simulation based on simulink
- typescript25 - type assertion
猜你喜欢

【愚公系列】2022年07月 Go教学课程 024-函数

【kali-信息收集】枚举——DNS枚举:DNSenum、fierce

风险策略调优中重要的三步分析法

typescript27-枚举类型呢

56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)

Excel record of integer programming optimization model to solve the problem

【愚公系列】2022年07月 Go教学课程 023-Go容器之列表

Hackers can how bad to what degree?

Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink

【无标题】
随机推荐
【愚公系列】2022年07月 Go教学课程 024-函数
UE4 从鼠标位置射出射线检测
PMP工具与技术总结
Li Chi's work and life summary in July 2022
解决ffmpeg使用screen-capture-recorder录屏,有屏幕缩放的情况下录不全的问题
typescript27 - what about enumeration types
TypeScript简化运行之ts-node
How to promote new products online?
ICML2022 | Deep Dive into Permutation-Sensitive Graph Neural Networks
律师解读 | 枪炮还是玫瑰?从大厂之争谈元宇宙互操作性
【kali-信息收集】枚举——DNS枚举:DNSenum、fierce
MySQL3
Simple and easy to use task queue - beanstalkd
「以云为核,无感极速」顶象第五代验证码
56:第五章:开发admin管理服务:9:开发【文件上传到,MongoDB的GridFS中,接口】;(把文件上传到GridFS的SOP)
数组问题之《下一个排列》、《旋转图像》以及二分查找之《搜索二维矩阵》
高数 | 【重积分】线面积分880例题
August 22 Promotion Ambassador Extra Reward Rules
Dart named parameter syntax
【无标题】