Joins

SQL Join Interview Questions

A join puts two tables side by side on a column they share, so you can use a name from one table and a number from the other. It is the most asked SQL topic in interviews, and the one that most often changes your row count without saying so.

What join questions ask you to do

Across the questions here, these are the shapes that come up:

  • Bring in a name or label from a second table
  • Find records that exist in one table and not the other
  • Keep rows that have no match on the other side
  • Compare a row with another row in the same table
  • Match on a date range rather than on an exact value

Common mistakes with joins

A LEFT JOIN keeps rows that have no match on the other side, but adding a condition on that second table in the WHERE clause throws those same rows away again and quietly turns it back into an ordinary join. The other trap is joining on a column whose values repeat, which multiplies rows and inflates every total built on them.

Questions to practice

Roles this comes up in

Companies these come from

Other topics