0

sql doubt

An employee is a manager if any other employee has their managerId set to the first employees id. An employee who is a manager may or may not also have a manager. TABLE employees id INTEGER NOT NULL PRIMARY KEY managerId INTEGER REFERENCES employees(id) name VARCHAR(30) NOT NULL Write a query that selects the names of employees who are not managers. CREATE TABLE employees ( id INTEGER NOT NULL PRIMARY KEY, managerId INTEGER REFERENCES employees(id), name VARCHAR(30) NOT NULL ); INSERT INTO employees(id, managerId, name) VALUES(1, NULL, 'John'); INSERT INTO employees(id, managerId, name) VALUES(2, 1, 'Mike'); -- Expected output (in any order): -- name -- ---- -- Mike -- Explanation: -- In this example. -- John is Mike's manager. Mike does not manage anyone. -- Mike is the only employee who does not manage anyone.

16th Sep 2018, 6:19 PM
Vikraant
3 Réponses
0
pls see updated question puny
16th Sep 2018, 6:37 PM
Vikraant
0
Hello.. guys.. who can help me in SQL.. please help its urgent..
16th Sep 2018, 6:38 PM
Sai Snata Dash
- 1
I just have some silly questions
16th Sep 2018, 6:45 PM
Sai Snata Dash