 Hello, Welcome to SSUnitech social decide. So today we are going to see a very common SQL interview question and answer. So more than 90% of the interviews interviewer is asking this question or this type of the question. I am taking guarantee if you are watching this video without skipping then you should be able to answer this question and this type of the questions in the interview without failing. Here let's try to understand the question first. So we are having two tables like table A1 and table 2. Table 1 is having only one column that is ID and table 2 also having one column that is ID. So here it is having ID 1 3 times ID 2 2 times then 3 and null. In case of table 2 ID 1 2 times ID 2 3 times then 4 null. While we are going to do the inner join, left outer join, right outer join, full outer join and cross join what will be the count of the rows. So this type of question will be asking very often. Let me quickly go inside the Excel and we will try to understand how we can know how many rows it will be returning. So here as we can see we are having table 1 and table 2 and the same record that we have seen inside the slide. So while we are going to do the join what you have to do you have to pick the first row from the left table and we will try to match with all the rows from the table 2. So 1 will be going to match with the 1 then 1. So first we will be going to match with two times. So I am going to write 2 here. Then we need to pick again second row from here so that we can see 1. So this 1 will be going to match with these two and it will again return 2. Next we can see the third one it will again return 2. So this is simply matching each row with all the rows from the table 2. In case of the 2 it will be going to match with the three rows as we can see. So that's why we can write as three rows. In case of the sixth row that is again 2 it will be going to match with the three times. So here we can write as 3. Then we can see 3 will not going to match with anyone and null will not be going to match with anyone because two null values are not same inside the six rows. So we can just do the sum of all these rows. So we can see 12 as in sum. So we can say that your inner join will be 12. Now in case of the left outer join what you have to do you have to do the same thing that you have done inside the inner join. So first we will be going to match with all the rows. So it will return 2 then 2 then 2. Then in case of the 2 it will be going to match three times. So we can say 3 and 3. Now here we can see this 3 is not going to match with anyone and null will not going to match with anyone. So in case of these two we can write 1 and 1 because it is having only a single value. Now we can do the sum of all these. So it will be your left join that we can see 14. So 14 will be your left join. Similarly we can do for the right outer join. So right outer join again we can do the same thing. We can match with the left table values one by one with all the values from the right table. So it will return 2 2 2 3 3. Till now we are using inner join. Now in case of the right outer join now we can see the right side values those has not been matched. So 4 is not matched with the left table and null will not be matched with the left table. So these two will be having 1 1 so we can see again 14. So in case of the right join it will be 14. Now in case of the full outer join we can do the inner join as we have done. Now we need to write all the values those has not been matched. So as we can see 3 and null. So like these two values has not matched with the right table. So we can write 2. Now 4 and null again not matched with the left table. So it will again then we can do the sum of all these. So it will be your full join. So we can see 16. So it will be 16. In case of the cross join we are seeing like it is having total 7 rows. So 7 multiplied by 7. So that will be your cross join. So that is 49. So by using this approach you will never fail and you should be able to answer this question very easily. So let me quickly go inside the SSMS and we will try to verify what you have seen over here is the same count we are getting or not. So here we have the table 1 and table 2. So these two 10 tables I am going to create and inserting the data into this table. Now records has been inserted and table is created. Now first we can see inner join. So let me try to execute for the inner join. We can see 12. We have also seen inside the excel that is 12. Let me go for the left join. So in case of the left join it is 14. We have seen 14. Similarly we can check for the right outer join. So it is again 14. We can see that is 14. Then we have 16 in case of the full join. So here we can see 16 in case of the full join and last for the cross join it is 49 that we can see. Inside the excel we can verify that. So I hope guys you have understand how you can provide the answer to the interviewer. Thank you so much for watching this video. If you like this video please subscribe our channel and press the bell icon to get the notification of our newly uploaded videos. See you in the next video.