r/learnSQL • • Oct 08 '26

Day 31 — Finished all Medium JOIN questions (70/100)

Wrapped up the Medium section of my 100-question JOIN lab today. The final batch included:

  • Average hours worked per project, joined with project and department names
  • Employees working on projects with a budget above 200,000
  • Each department along with its most expensive project
  • Employees assigned to all projects in their own department. This is the "for all" type of question, and it's the hardest to reason about in SQL
  • Every manager with the department(s) their direct reports belong to
  • Pairs of projects that share at least one common employee (self-join on assignments)

The "ALL projects" question and the project-pairs question were the toughest. Both needed me to draw the tables out and trace a few rows by hand before the query logic made sense.

37 Upvotes

27 comments sorted by