Database Joins: An Interactive Exploration

Overview

This interactive tool visualizes all seven types of SQL joins using an Employees and Departments database. Toggle between INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, CROSS JOIN, SEMI JOIN, and ANTI JOIN to see how each affects the result set. Modify the data in real-time to understand how joins combine tables through related columns and when to use each type.

Open in new tab

Tips

  • Use INNER JOIN for most queries where you only want matching records from both tables (e.g., employees who have departments)
  • Choose LEFT JOIN when you need all records from the first table even if there’s no match (e.g., all employees including those without departments)
  • CROSS JOIN creates every possible combination - use it sparingly as it can produce huge result sets (rows in table A × rows in table B)
  • SEMI JOIN is perfect when you only need columns from one table but want to filter based on existence in another table
  • Watch how NULL values appear in LEFT/RIGHT/FULL OUTER JOINs for non-matching rows - these are crucial for identifying missing relationships
  • Modify the sample data to add employees without departments or departments without employees to see how different joins handle these cases
  • Remember the difference between ON and WHERE clauses: ON filters during the join, WHERE filters after, which matters for outer joins