For each employee in employee table, find number of direct and indirect bosses in hierarchy
问题 I am given an employee table which looks something like this: Queries to create sample input. CREATE TABLE employee( empId INTEGER, empName VARCHAR(20), mgrId INTEGER, salary DECIMAL(12,2) ); INSERT INTO employee VALUES (1, 'A', 2, 100), (2, 'B', 4, 150), (3, 'C', 4, 165), (4, 'D', 7, 200), (5, 'E', 6, 210), (6, 'F', 7, 250), (7, 'G', 7, 300), (8, 'H', 6, 170); Link to SQL Fiddle: http://sqlfiddle.com/#!9/cd4be8 This sample data results in this hierarchy. Each employee has a direct boss. Also