Search⌘ K

Planning Join Paths

Learn how to connect data across tables.

Step 1: Start with a problem, not code

So far, you’ve executed joins. Now let’s learn to plan them.

Imagine your database has three tables:

  • employees contains employee_id, name, department_id.

  • departments contains department_id, department_name, manager_id.

  • managers contains manager_id, manager_name.

And your question is: What is each employee’s name, their department name, and their manager’s name?

Before writing SQL, pause.

Can you visualize the path of relationships? Try to map it mentally or sketch it: employeesdepartmentsmanagers

Prompt hint: Describe how to plan the join path between employees, departments, and managers to answer the ...