SQL practice: A Table Joined to Itself

Chapter 14B · 10 questions · included in full access

  1. Question 1 · easy

    List every employee with their manager's name, showing NULL where there is none.

    Solve it in your browser
  2. Question 2 · easy

    List every employee with their manager's name and their manager's salary.

    Solve it in your browser
  3. Question 3 · medium

    Find the employees who earn more than their own manager.

    Solve it in your browser
  4. Question 4 · medium

    List only the employees who have a manager. (Which join should you use now?)

    Solve it in your browser
  5. Question 5 · medium

    List the employees who have no manager.

    Solve it in your browser
  6. Question 6 · medium

    Show every stock transfer with the from-branch and to-branch names.

    Solve it in your browser
  7. Question 7 · medium

    Show every stock transfer with the from-branch city and to-branch city.

    Solve it in your browser
  8. Question 8 · medium

    Show each employee, their manager's name, and their manager's branch name. (Three aliases now.)

    Solve it in your browser
  9. Question 9 · hard

    Explain why SELECT employees.employee_name FROM employees e JOIN employees m ... would fail.

    Solve it in your browser
  10. Question 10 · hard

    List each pair of employees who work in the same branch, once per pair, with the lower employee_id first. Every pair shows up twice. Fix it.

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing