SQL Self Join

6.What does this return?- If Ravi is a top-level manager?
SELECT A.name, B.name FROM employees A LEFT JOIN employees B ON A.manager_id = B.id;
  • A. NULL in B.name for Ravi
  • B. Skips Ravi
  • C. Ravi joins with himself
  • D. Error

NULL in B.name for Ravi

NULL in B.name for Ravi

7.Which scenario suits SELF JOIN best?
  • A. Products with categories
  • B. Employee hierarchy
  • C. Courses and students
  • D. Normalization

Employee hierarchy

Employee hierarchy

8.Output of this query: If e1 has no manager, then manager column = ?
SELECT e1.name, e2.name AS manager FROM employees e1 LEFT JOIN employees e2 ON e1.manager_id = e2.id;
  • A. e1.name
  • B. NULL
  • C. 0
  • D. Error

NULL

NULL

9.In a SELF JOIN, how many copies of the same table are used in FROM clause?
  • A. 1
  • B. 2
  • C. Unlimited
  • D. Depends on data

2

2

10.Can aliases be used in SELF JOIN?
  • A. No
  • B. Yes, required
  • C. Optional
  • D. Aliases not supported in SQL

Yes, required

Yes, required