【MySQL】【leetcode】 Employees Earning More Than Their Managers解题报告
2015-10-20 17:09
471 查看
题目
The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.Id | Name | Salary | ManagerId |
---|---|---|---|
1 | Joe | 70000 | 3 |
2 | Henry | 80000 | 4 |
3 | Sam | 60000 | NULL |
4 | Max | 90000 | NULL |
+———-+
| Employee |
+———-+
| Joe |
+———-+
代码
到底谁比它主管的工资还高?# Write your MySQL query statement below select e1.Name as Employee from Employee as e1, Employee as e2 where e1.ManagerId = e2.Id and e1.Salary > e2.Salary;
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- Android之获取手机上的图片和视频缩略图thumbnails
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- 数据库链接字符串查询网站
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法