userasebo.blogg.se

Tricky sas interview questions
Tricky sas interview questions









So if look at both tables data, we found that two records (1 & 2) of the table tbl_samplejoin1 has the matching records in the second table tbl_samplejoin2. For all matching records, it returns the matched records from the right table and for not matching records, it return with NULL value. Left Outer Join:- This join returns all records from the left table irrespective of whether right table contains the matching records or not. let first discuss about Left outer join before we proceed towards its answer. SQL query in the 2nd interview question talks about the Left outer join. Therefore, when we execute the inner query mentioned in the screenshot, it gives only 2 records.ī) Answer of the 2nd interview question containing the Left Outer Join Now if we look at the records of both tables, there are only 2 matching records with value 1 & 2. In other words you can say that it gives all the records of the left table which have the matching records from the right table

tricky sas interview questions

Inner Join:- This join returns all the rows from both tables where there is a match. Before we going to discuss the outcome of the inner join query which is shown in the below screenshot, let refresh the concept of Inner Join. If we look the first interview question, SQL query is a Inner Join between the 2 tables. Lets explains the outcomes of these 4 SQL joins queries one by one Answers with explanationĪ) Answer of the first interview question containing the Inner Join Now suppose both tables contains the unique records as shown in the below screenshot.

#Tricky sas interview questions full#

This is the most basic and common interview scenario where interviewer asked the outcome of query containing either Inner SQL Join or Left Outer Join or Right Outer Join or the Full Outer Join using the table containing the unique records in the columns on which join is define. These questions are the basic interview questions to check interview candidate basic concepts and practical knowledge on SQL joins. Interview Scenario 1: Join Columns having Unique Values We are going to use the below mentioned 4 SQL Joins queries for better understanding in each scenario of data.Ī) What will the outcome of the following inner join query? SELECT a.Col1, b.Col2įROM tbl_samplejoin1 a INNER JOIN tbl_samplejoin2 bī) What will the outcome of the following left outer join query? SELECT a.Col1, b.Col2įROM tbl_samplejoin1 a LEFT OUTER JOIN tbl_samplejoin2 bĬ) What will the outcome of the following right outer join query? SELECT a.Col1, b.Col2įROM tbl_samplejoin1 a RIGHT OUTER JOIN tbl_samplejoin2 bĭ) What will the outcome of the following full outer join query? SELECT a.Col1, b.Col2įROM tbl_samplejoin1 a FULL OUTER JOIN tbl_samplejoin2 b In this article, we are going to explain the impact of having the unique records or duplicate records or Null value on the outcome on the Inner Join, Left Outer Join, Right Outer Join and the Full Outer Join.

tricky sas interview questions

Table tbl_samplejoin1 contains the column Col1 and table tbl_samplejoin2 has the column Col2. Each of these 2 tables contains one column on which join condition has been defined.

tricky sas interview questions

In this article we are going to use 2 tables tbl_samplejoin1 & tbl_samplejoin2. Sql Joins- Inner Joins, Self Joins, Outer Joins, Cross Joins Tables to be use This below article on SQL Joins may help you in getting more information about SQL Joins concepts. I am also going to explain these SQL Joins concepts with the help of interview questions which we are going to discuss in this article but it is better to have some prior basic knowledge of SQL Join. In this article, we are going to cover the SQL Join interview questions with answer where columns with SQL Joins condition may contain:īefore proceeding further, I assume that you have the basic knowledge of SQL Joins concepts. Here in this article, I am going to share these SQL Joins tricky interview questions. But in case of some interviews, interviewers may make it trickier by asking SQL joins puzzles (queries) where these join columns may contains either duplicate values or NULL values which makes the result interesting and interview candidate confuse about outcome of these queries. If the candidate has knowledge about SQL Joins concepts and join columns contains unique values, these SQL joins questions are not difficult to answer.

tricky sas interview questions

In most of the SQL interviews, questions are asked about SQL Joins irrespective of the number of years experience one have. SQL Joins is always an important topic of SQL Server. SQL Joins Tricky Interview Questions Introduction









Tricky sas interview questions