当前位置:网站首页>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
);
边栏推荐
- MySQL4
- "ArchSummit: The cry of the times, technical people can hear"
- lambda
- typescript19-对象可选参数
- The 16th day of the special assault version of the sword offer
- typescript26 - literal types
- 数组问题之《两数之和》以及《三数之和 》
- Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
- typescript21-接口和类型别名的对比
- 李迟2022年7月工作生活总结
猜你喜欢

typescript24-类型推论

时时刻刻保持敬畏之心
![Valentine's Day Romantic 3D Photo Wall [with source code]](/img/a9/2c26f4f048f3c0a9a65551bc734233.png)
Valentine's Day Romantic 3D Photo Wall [with source code]

律师解读 | 枪炮还是玫瑰?从大厂之争谈元宇宙互操作性

UE4 rays flashed from mouse position detection

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

Message queue MySQL table for storing message data

Make your Lottie support word wrapping in text fields

数组问题之《下一个排列》、《旋转图像》以及二分查找之《搜索二维矩阵》

Summary of mobile page optimization in seconds
随机推荐
The 16th day of the special assault version of the sword offer
Typescript22 - interface inheritance
最新 955 不加班的公司名单
Software Testing Weekly (Issue 82): In fact, all those who are entangled in making choices already have the answer in their hearts, and consultation is just to get the choice that they prefer.
What is a programming language
深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
Message queue MySQL table for storing message data
怀念故乡的月亮
Excel做题记录——整数规划优化模型
Pyspark机器学习:向量及其常用操作
typescript28 - value of enumeration type and data enumeration
Message Queuing Message Storage Design (Architecture Camp Module 8 Jobs)
【无标题】
typescript23-tuple
【目标检测】YOLOv7理论简介+实践测试
Advice given by experts with four years of development experience in Flutter tutorial
Unity's primary method for implementing PlanarReflection under the BuildIn rendering pipeline
Introduction to the Elastic Stack
基于ProXmoX VE的虚拟化家庭服务器(篇一)—ProXmoX VE 安装及基础配置
Message queue design based on mysql