Below is the link to my sqlfiddle where my code works. i don't know why my code isn't accepted in here in OJ.
If the link isn't accessible below is the meta-data to create the dummy data:
CREATE TABLE Employee( Id int, Name Varchar(50), Salary int, ManagerId int ); INSERT INTO Employee VALUES(1, "Mark", 30000, 2); INSERT INTO Employee VALUES(2, "Jack", 20000, NULL); SELECT E.Name as Employee FROM (SELECT Name, ManagerId, Salary FROM Employee WHERE ManagerId IS NOT NULL) E INNER JOIN (SELECT Id, Salary FROM Employee WHERE ManagerId IS NULL)M ON E.ManagerId = M.Id AND E.Salary > M.Salary
- You don't need to create table
- You don't need to provide data
- It requests to output "Name" as "Employee"
- Read my comments properly. I gave that for someone to test my data against using sqlfiddle for which I even provided the link. Otherwise s/he cannot test my sql.
- And even adding Employee as alias doesn't work.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.