SQL-Employees Earning More Than Their Managers
思路:
今天复习数据库突然想起来leetcode上数据库的题目,就找来做了
(1)给表取别名
格式见code,这在自身连接的时候是很有必要的
(2)自身连接
from语句后面相当于接了“一张表”,如果是多个表,就相当于形成了他们的笛卡尔积
然后通过where语句选择出所需要的行,通过头上的select语句选出相应的列
# Write your MySQL query statement below
select a.Name from Employee as a,Employee as b
where a.ManagerId = b.Id and a.Salary > b.Salary
SQL-Employees Earning More Than Their Managers的更多相关文章
- LeetCode SQL:Employees Earning More Than Their Managers
# Write your MySQL query statement below SELECT a.Name FROM Employee AS a INNER JOIN Employee AS b O ...
- [SQL]LeetCode181. 超过经理收入的员工 | Employees Earning More Than Their Managers
SQL架构 Create table If Not Exists Employee (Id ), Salary int, ManagerId int) Truncate table Employee ...
- 【SQL】181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- [LeetCode] Employees Earning More Than Their Managers 员工挣得比经理多
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- LeeCode(Database)-Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- Leetcode 181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- LeetCode - Employees Earning More Than Their Managers
Description: The Employee table holds all employees including their managers. Every employee has an ...
- 181. Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- DataBase -- Employees Earning More Than Their Managers My Submissions Question
Question: The Employee table holds all employees including their managers. Every employee has an Id, ...
- Employees Earning More Than Their Managers
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
随机推荐
- Neutron中的Service类
Service是OpenStack中非常重要的一个概念,各个服务的组件都以Service类的方式来进行交互. Neutron中的Service类继承自rpc中的Service,总体的继承关系为 neu ...
- Linux入门基础 #6:Linux用户基础
本文出自 http://blog.csdn.net/shuangde800 ------------------------------------------------------------ ...
- [Javascript] Advanced Reduce: Common Mistakes
Take away: Always check you ruturn the accumulator Always pass in the inital value var data = [" ...
- rman catalog (rman 恢复目录)
受控制文件大小的限制,一般rman需要用rman catalog来管理及存放备份信息: 这里介绍一下创建rman catalog的步骤: C:\Documents andSettings\Admini ...
- Fragment 事务 回退栈
一些相关API 1.Fragment常用的三个类: android.app.Fragment 定义android.app.FragmentManager 用于在Activity中操作Fragmenta ...
- JAVA List与数组间相互转换
1.list转数组 例如: List<String> list = new ArrayList<String>(); list.add("aa"); li ...
- json数据相对于xml数据.
JSON is a valid subset of JavaScript, Python, and YAML JSON parsing is generally faster than XML par ...
- c - 字符串的拼接.
完整代码: #include <stdio.h> #include <string.h> #include <malloc.h> #define TRUE 1 #d ...
- 搭建Struts2开发环境
搭建Struts2环境时,我们一般需要做以下几个步骤的工作: 1.创建javaweb工程 2.找到开发Struts2应用需要使用到的jar文件 3.创建jsp文件 4.创建action文件 5.编写S ...
- 3D跑酷游戏《月影忍者之疾风狂逃》
<月影忍者之疾风狂逃>是一款3D跑酷游戏,也是我实习的时候参与的一个项目,在那个公司我学到了很多东西,谢谢他们.大家可以去玩玩这个游戏啊,还是不错的哦.