-- Self Join 

CREATE TABLE Employee( 
    ID INT PRIMARY KEY, 
    Name VARCHAR(40), 
    ManagerID INT
    ); 

INSERT INTO Employee(ID, Name, ManagerID)VALUES 
    (1, 'Alice Johnson', NULL), 
    (2, 'Bob Smith', 1), 
    (3, 'Carol Davis', 1), 
    (4, 'David Lee', 2), 
    (5, 'Eva Martinez', 3); 

SELECT E.Name AS Employee, M.Name AS Manager
FROM Employee E 
INNER JOIN Employee M ON E.ManagerId = M.ID 
ORDER BY E.Name; 

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: