HomeInterview QuestionsWhat are the types of joins? Write the output of e…

What are the types of joins? Write the output of each join.

🟡 Medium Conceptual Mid level
1Times asked
Jun 2026Last seen
Jun 2026First seen

💡 Model Answer

SQL supports several join types:

  1. INNER JOIN – Returns rows that have matching values in both tables. Example: If A has (1,2,3) and B has (2,3,4), the inner join on the key returns (2,3).
  1. LEFT (OUTER) JOIN – Returns all rows from the left table and matching rows from the right table; unmatched rows from the right are NULL. Example: A (1,2,3) left join B (2,3,4) yields (1,NULL), (2,2), (3,3).
  1. RIGHT (OUTER) JOIN – Symmetric to LEFT JOIN, returning all rows from the right table. Example: A left join B gives (1,NULL),(2,2),(3,3); right join gives (2,2),(3,3),(4,NULL).
  1. FULL (OUTER) JOIN – Returns all rows when there is a match in either table; unmatched rows are NULL. Example: A (1,2,3) full join B (2,3,4) yields (1,NULL),(2,2),(3,3),(4,NULL).
  1. CROSS JOIN – Produces the Cartesian product of the two tables. Example: A (1,2) cross B (3,4) yields (1,3),(1,4),(2,3),(2,4).
  1. SELF JOIN – A table joined to itself, often used to compare rows within the same table. Example: Employees table joined on manager_id to list each employee with their manager.

Each join type serves a specific purpose, and choosing the right one depends on the desired result set and the relationships between the tables.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500