Help me create a table with all the employee Names and Manager Names. SQL OYO interview Questions

Question

Employee_Name Employee_Id Manager_Id
A                                1                           2
B                                2                           3
C                                3                           2
D                               4                            3

in progress 4
TheDataMonk 55 years 18 Answers 1883 views Grand Master 0

Answers ( 18 )

  1. select e1.Employee_name, e2.Employee_name from Employee e1, Employee e2 where e1.Manager_id=e2.Employee_id;

  2. SELECT
    e.employee_id
    ,e.employee_name
    ,e.manager_id
    ,m.employee_name AS manager_name
    FROM employees e JOIN employees m ON e.manager_id = m.employee_id

  3. SELECT e.EMployee_name ,m.emp_name as Manager_name
    FROM Employees e JOIN Employees m
    on e.manager_id =m.employee_id;

  4. SELECT Employee_Name, Manager_Name
    FROM Employee INNER JOIN Employee_Id = Manager_Id

  5. SELECT Employee_Name, Manager_Name
    FROM Employee INNER JOIN Employee_Id = Manager_Id;

  6. SELECT
    e.Employee_name,
    m.Employee_name as Manager_name
    FROM Employees e
    JOIN
    Employees m
    ON
    e.Manager_id = m.Employee_id;

  7. SELECT e.EMployee_name ,m.emp_name as Manager_name
    FROM Employees e JOIN Employees m
    on e.manager_id =m.employee_id;

  8. select e1.Employee_name, e2.Employee_name from Employee e1 inner join Employee e2 on e1.Manager_id=e2.Employee_id;

  9. SELECT e.Employee_name, m.Employee_name as Manager_name
    FROM Employees e JOIN Employees m
    on e.manager_id =m.employee_id;

  10. SELECT e1.Employee_Name, e2.Employee_Name As Manager_Name
    FROM Employee e1
    INNER JOIN Employee e2
    WHERE e1.Employee_id = e2.Manager_id

  11. SELECT e1.Employee_Name, e2.Employee_Name AS Manager_name
    FROM Employee e1
    INNER JOIN Employee e2
    WHERE e1.Employee_id=e2.Manager_id

  12. SELECT
    e.Employee_name,
    m.Employee_name as Manager_name
    FROM Employees e
    LEFT JOIN
    Employees m
    ON
    e.Manager_id = m.Employee_id;

  13. SELECT
    E.Employeename,
    M.Employeename as Managername
    FROM Employees E
    LEFT JOIN
    Employees M
    ON
    E.Managerid = M.Employeeid;

  14. SELECT
    E.EmployeeName,
    M.EmployeeName as ManagerName
    FROM Employees E
    LEFT JOIN
    Employees M
    ON
    E.ManagerId = M.EmployeeId

  15. i think the answer will have a left join on the employees E table , am i correct?

Leave an answer

Browse
Browse