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 ...
随机推荐
- Win7系统安装MySQL5.5.21图解教程
转自:http://www.jb51.net/article/37310.htm 这篇文章主要介绍了如何在win7中安装mysql,所以加上了MySQL的下载过程,希望对需要的人有所帮助 大家都知道M ...
- poj 1328 贪心
/* 贪心.... 处理处每个点按照最大距离在x轴上的映射 然后我们就有了一些线段 目的是选取尽量少的点 使得每个线段内都有点出现 我们按照左端点排序 然后逐一处理 假设第一个雷达安在第一个线段的右端 ...
- hdu 2156
#include <iostream> #include <stdio.h> using namespace std; int main() { int i,n; while( ...
- hdu 2111
#include <iostream> #include <algorithm> using namespace std; struct money { int s; int ...
- (转)HTML特殊字符
HTML 原始码 显示结果 描述 < < 小於号或显示标记 > > 大於号或显示标记 & & 可用於显示其它特殊字符 " " 引号 ® ® ...
- 把数据库中的null作为条件查询应该用is
如select * from mbXX where tuijian is null 而不是select * from mbXX where tuijian=null
- maven项目,去除jar包中的不想要的依赖关系(Document root element "beans", must match DOCTYPE root "null". )
maven dependencies中并不会删除 以下方法maven dependencies中并不会删除,可能程序引入的时候,会去掉这种依赖(猜的) 解释: 就是说项目中要用到某一个a.jar包,通 ...
- Tomcat6.0数据源配置
涉及context.xml和server.xml http://blog.csdn.net/onlymilan/article/details/5493485
- ORA-16014: 日志 1 的序列号 242 未归档, 没有可用的目的地
SQL> alter database open; *第 1 行出现错误:ORA-16014: 日志 1 的序列号 242 未归档, 没有可用的目的地ORA-00312: 联机日志 1 线程 1 ...
- c#之线程入门
C#支持通过多线程并行地执行代码,一个线程有它独立的执行路径,能够与其它的线程同时地运行.一个C#程序开始于一个单线程,这个单线程是被CLR和操作系统(也称为“主线程”)自动创建的,并具有多线程创建额 ...