Skip to content
Advertisement

I was asked the following pseudocode in a SQL interview based on joining condition. Can anyone explain what went went wrong with my approach?

[two tables-ta and tb with respective columns ]1

I was asked to put a LEFT JOIN on item id and explain what would be the possible output. I wrote a pseudocode like this-

I told them the output would look like this, which they told is not the right answer.

Can anyone explain what would be the correct answer along with logic?

Advertisement

Answer

if the data in the screenshot was the data they gave you , all item ids are -1 which means no matter if you do inner join or outer join , its gonna be a cross join meaning you will have all combination of table1 with table 2 which will be 12 rows

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement