Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. 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.
  2.  
  3. TABLE employees
  4. id INTEGER NOT NULL PRIMARY KEY
  5. managerId INTEGER REFERENCES employees(id)
  6. name VARCHAR(30) NOT NULL
  7.  
  8. SELECT name
  9. FROM employees
  10. where id NOT IN (
  11. SELECT managerId FROM employees where managerId is not null
  12. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement