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 ...
随机推荐
- [Protractor] Test Simple Binding With Protractor
Protractor is built to interact with AngularJS applications. In this lesson, we will take a look at ...
- MM32/STM32中断和事件梳理
Interrupt_event梳理 预备资料 MM32/stm32中文参考手册 Cortex-M3权威指南(深入了解中断和异常) MM32F103产品手册(配置GPIO的复用功能可能用到) 提出问题 ...
- poj 1988 Cube Stacking && codevs 1540 银河英雄传说(加权并茶几)
#include<iostream> #include<cstdio> #include<cstring> #define maxn 30010 using nam ...
- The requested page cannot be accessed because the related configuration data for the page is invalid
当在VS2013下开发web site时,调试时都是在IIS Express中进行的,没有问题.当部署到IIS中,出现:The requested page cannot be accessed be ...
- 关于JS、JQuery、CSS的小知识点
1.将字符串转换成json列表格式如下: var getaddress = appcan.libuser.getAddress(); var address=JSON.parse(getaddress ...
- centos安装vim以及设置
原文链接:http://www.xiaohuai.com/2884 Centos里的VI只默认安装了vim-minimal-7.x.所以无论是输入vi或者 vim查看文件,syntax功能都无法正常启 ...
- Linux文件和目录操作管理命令
1.pwd:显示工作目录路径 -p:显示实际物理路径 -l:显示链接路径 2.cd:更改工作目录路径 cd:进入用户主目录 cd~:进入用户主目录 cd-:返回进入此目录之前所在的目录 cd..:返回 ...
- Linux误删C基本运行库libc.so.6急救方法
首先普及一下关于libc.so.6的基本常识: libc.so.6是glibc的软链接 ll /lib64/libc.so.6lrwxrwxrwx 1 root root 11 Aug 27 201 ...
- rsync从windows到linux的同步备份
名称 角色 IP地址 Windows server 2003 服务器 Eth0:192.168.1.1 RHEL5.5 客户端 Eth0:192.168.1.2 一.cwRsyncServer服务 ...
- 【转】深入理解Java内存模型(一)——基础
并发编程模型的分类 在并发编程中,我们需要处理两个关键问题:线程之间如何通信及线程之间如何同步(这里的线程是指并发执行的活动实体).通信是指线程之间以何种机制来交换信息.在命令式编程中,线程之间的通信 ...