Think differently!
Instead of "tables", think "sets", and your life in SQL will be much easier. So, in this case, you can view this "table" as a bunch of different sets, which you can define with predicates.
So, if you have an employee table, one set is all employees. The other set can be the supervisors of those employees. The JOIN clause helps you define the retrieval conditions for that second set, and you can also add more conditions in the WHERE clause if you need to.
This is Set 1 (all employees):
SELECT
e.employeeId,
e.employeeName,
e.supervisorId
FROM
employee e
This is Set 2 (all supervisors):
SELECT
e.employeeId,
e.employeeName
FROM
employee e
WHERE
e.employeeId IN
(
SELECT DISTINCT supervisorId FROM employee WHERE supervisorId IS NOT NULL
)
Your SELECT query's output is a new set (or "table", if you will), which JOINs the supervisor set to the employee set, so as to associate the supervisor with the employee, thereby creating a new set, comprised of a newly-defined tuple that has more attributes.
You could treat these as "tables", and JOIN them accordingly:
SELECT
emp.employeeId,
emp.employeeName,
emp.supervisorId,
sup.employeeName supervisorName
FROM
(
SELECT
e.employeeId,
e.employeeName,
e.supervisorId
FROM
employee e
) emp
INNER JOIN
(
SELECT
e.employeeId,
e.employeeName
FROM
employee e
WHERE
e.employeeId IN
(
SELECT DISTINCT supervisorId FROM employee WHERE supervisorId IS NOT NULL
)
) sup ON
sup.employeeId = emp.supervisorId
You can see now how we have created 2 "tables" (sets) on the fly, and JOINed them. However, this contrived example is needlessly complicated. We can achieve the same thing this way:
SELECT
emp.employeeId,
emp.employeeName,
emp.supervisorId,
sup.employeeName supervisorName
FROM
employee emp
INNER JOIN employee sup ON
sup.employeeId = emp.supervisorId
This achieves the same thing, namely defining a new set based on the JOIN between one set of employee tuples and another. Note that this new set can also be used as a "table". It's just a matter of how you think.
See this resource for more visualizations:
Visual Representation of SQL Joins