HomeInterview QuestionsGiven two tables A and B, can you write the number…

Given two tables A and B, can you write the number of rows that would result from an inner join, a left join, and an outer join?

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

💡 Model Answer

Assuming the sample data from the interview: Table A has values [1,1,1,2,2,3,null,null] and Table B has [1,2,3,null]. For an inner join, only matching non‑NULL values are considered. A has three 1s, two 2s, and one 3; B has one 1, one 2, one 3, and one NULL. The inner join produces 3×1 + 2×1 + 1×1 = 6 rows. A left join returns all rows from A, matching B where possible, so it yields 8 rows (the 6 matched plus the two NULLs from A). An outer join returns all rows from both tables, so 8 (A) + 4 (B) = 12 rows. Thus: inner join = 6 rows, left join = 8 rows, outer join = 12 rows.

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