HomeInterview QuestionsGiven the following tables: TableA: | id | |----|…

Given the following tables: TableA: | id | |----| | 1 | | 1 | | 2 | | 3 | | 4 | TableB: | id | |----| | 1 | | 2 | | 3 | | 4 | How many records would result from an inner join and from a left join on the id column?

🟢 Easy Conceptual Junior level
1Times asked
May 2026Last seen
May 2026First seen

💡 Model Answer

For an inner join, only rows with matching ids in both tables are returned. TableA has two rows with id 1, while TableB has one row with id 1. The other ids (2, 3, 4) each appear once in both tables. Thus the inner join yields 2 (for id 1) + 1 (id 2) + 1 (id 3) + 1 (id 4) = 5 rows.

A left join returns all rows from the left table (TableA) and matching rows from the right table. Since TableA has 5 rows, the left join will also return 5 rows, with NULLs for any columns from TableB where there is no match. In this case every id in TableA has a match in TableB, so the result is the same 5 rows as the inner join.

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