当前位置:网站首页>MySQL Practice Summary -
MySQL Practice Summary -
2022-08-01 04:48:00 【LXMXHJ】
Article table of contents
Case 1:
Known Information
Employee Table Employee
Name | Type | Description |
---|---|---|
EmployeeId | Int | Employee id (unique) |
Name | Varchar(50) | Employee Name |
Age | Int | Employee Age |
Varchar(50) | Staff Email | |
Level | Int | Employee Level |
Salary salary
Name | Type | Description |
---|---|---|
SalaryId | Int | salary id (unique) |
EmployeeId | Int | employee id |
Money | Double | Wage Amount |
Date | Datetime | release date |
Questions and Answers
Query the names and email addresses of occasional employees, and sort by age in descending order and name in ascending order.
select Name,Emailfrom Employeeorder by Age asc,Name desc;
Query the names of all employees with employee level 1 and the sum of their corresponding salary amounts.
①select e.Name,s.Moneyfrom Employee einner join Salary son e.EmployeeId = s.EmployeeIdwhere e.Level = 1
Query all salary payment information higher than average salary and corresponding employee information (payment date, salary amount, employee id, employee name, employee age, employee email, employee level)
select s.Date,s.Money,s.EmployeeId,e.Name,e,Age,e.Email,e.Levelfrom Employee einner join Salary son e.EmployeeId = s.EmployeeIdwhere s.Money >(select avg(Money)from Salary);
边栏推荐
- Immutable
- /etc/fstab
- In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
- MySQL4
- 怀念故乡的月亮
- Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
- How to promote new products online?
- 动态规划 01背包
- MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
- MLP neural network, GRNN neural network, SVM neural network and deep learning neural network compare and identify human health and non-health data
猜你喜欢
Mysql基础篇(Mysql数据类型)
智芯传感输液泵压力传感器 为精准智能控制注入科技“强心剂”
Dry goods!How to Construct SRv6-TE Performance Test Environment Using Instrumentation
[kali-information collection] enumeration - DNS enumeration: DNSenum, fierce
A way to deal with infinite debugger
UE4 制作遇到的问题
Valentine's Day Romantic 3D Photo Wall [with source code]
TypeScript simplifies running ts-node
MySQL4
万字逐行解析与实现Transformer,并进行德译英实战(一)
随机推荐
深圳某游戏研发公司给每个工位都装监控,网友:堪比坐牢!
UE4 制作遇到的问题
阿叶的目标
typescript19-对象可选参数
MySQL-数据操作-分组查询-连接查询-子查询-分页查询-联合查询
IJCAI2022 | Hybrid Probabilistic Reasoning with Algebraic and Logical Constraints
scheduleWithFixedDelay和scheduleAtFixedRate的区别
报错:AttributeError: module ‘matplotlib’ has no attribute ‘figure’
【愚公系列】2022年07月 Go教学课程 025-递归函数
typescript26-字面量类型
PMP 项目资源管理
UE4 rays flashed from mouse position detection
挑战52天背完小猪佩奇(第01天)
时时刻刻保持敬畏之心
Write a method to flatten an array and deduplicate and sort it incrementally
万字逐行解析与实现Transformer,并进行德译英实战(三)
typescript28 - value of enumeration type and data enumeration
/etc/fstab
Simulation of Active anti-islanding-AFD Active Anti-islanding Model Based on Simulink
Interview Blitz 69: Is TCP Reliable?Why?