2021年3月22日星期一

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-

SELECT      table a.ITEM ID,      table a.ITEM NAME,      table b.ITEM ID,      table b.ITEM NAME  from      table a      LEFT JOIN table b ON table a.ITEM ID = table b.ITEM ID;  

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

ITEM ID ITEM NAME   ITEM ID ITEM NAME  -1      X            -1     P  -1      Y            -1     Q  -1      Z            -1     R  -1      W         

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

https://stackoverflow.com/questions/66756170/i-was-asked-the-following-pseudocode-in-a-sql-interview-based-on-joining-conditi March 23, 2021 at 09:50AM

没有评论:

发表评论