自我加入桌子

Moh*_*tha 5 sql self-join

我有一张桌子

Employee
==================
name      salary
==================
a        10000
b        20000
c        5000
d        40000
Run Code Online (Sandbox Code Playgroud)

我希望得到薪水高于A薪水的所有员工.我不想使用任何嵌套或子查询.有人在接受采访时提出要求并提示使用自我加入.我真的无法弄清楚如何实现同样的目标.

Sal*_*lil 16

select e1.* from Employee e1, Employee e2  where 
           e2.name = 'a' and
           e1.salary > e2.salary
Run Code Online (Sandbox Code Playgroud)

使用自联接

 select e1.* from Employee e1 join Employee e2  on 
           e2.name = 'a' and
           e1.salary > e2.salary
Run Code Online (Sandbox Code Playgroud)