SQL Interview: 46 Self-join requirements

SQL Interview: 46 Self-join requirements

This is a post in the SQL Interview series. These aren’t trick or gotcha questions, they’re just questions designed to scope out a candidate’s knowledge around SQL Server and Azure SQL Database.

Section: Developer Level: Intro

Question:

You have a table named HumanResources.Employees. Some employees are managers.

You want to join the table to itself to join employee rows with their manager rows.

What is required when you join a table to itself, that is not required for joining separate tables?

Answer:

When you join a table to itself, you must use a table alias. (This identifies which instance of the table is which).

2025-05-10